From f1bb7cfcbdbfee7488f59256522be18f8d2eb0a3 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Mon, 20 May 2024 10:11:47 +0200 Subject: [PATCH] fix(backend): improve memory usage by making schema RawValue instead of serde_json::Value --- backend/windmill-common/src/scripts.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/backend/windmill-common/src/scripts.rs b/backend/windmill-common/src/scripts.rs index 99d77e9f81..54b3a0d47f 100644 --- a/backend/windmill-common/src/scripts.rs +++ b/backend/windmill-common/src/scripts.rs @@ -18,7 +18,6 @@ use crate::{ }; use serde::de::Error as _; use serde::{ser::SerializeSeq, Deserialize, Deserializer, Serialize}; -use serde_json::to_string_pretty; use crate::utils::StripPath; @@ -227,13 +226,11 @@ pub struct ScriptHistoryUpdate { #[derive(Serialize, Deserialize, Debug, sqlx::Type)] #[sqlx(transparent)] #[serde(transparent)] -pub struct Schema(pub serde_json::Value); +pub struct Schema(pub sqlx::types::Json>); impl Hash for Schema { fn hash(&self, state: &mut H) { - if let Ok(s) = to_string_pretty(&self.0) { - s.hash(state); - } + self.0.get().hash(state); } }