The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Fix streaming with serdes (#72457)
Alexander Polyankin416a8cc63f95
diff --git a/enterprise/backend/src/metabase_enterprise/serialization/v2/storage.clj b/enterprise/backend/src/metabase_enterprise/serialization/v2/storage.cljindex 9723303e81b..eee0dae34b3 100644--- a/enterprise/backend/src/metabase_enterprise/serialization/v2/storage.clj+++ b/enterprise/backend/src/metabase_enterprise/serialization/v2/storage.clj@@ -6,20 +6,24 @@(defn store!"Consume the entity `stream` and store each entity via the given `writer`.- Returns a report map with `:seen` and `:errors` vectors."+ Returns a report map with `:seen` and `:errors` vectors.++ Uses `run!` to make elements reach the writer as they are produced and+ not materialize the entire upstream before the loop body."[stream writer](let [settings (atom [])report (atom {:seen [] :errors []})]- (doseq [entity stream]- (cond- (instance? Exception entity)- (swap! report update :errors conj entity)+ (run! (fn [entity]+ (cond+ (instance? Exception entity)+ (swap! report update :errors conj entity)- (-> entity :serdes/meta last :model (= "Setting"))- (swap! settings conj entity)+ (-> entity :serdes/meta last :model (= "Setting"))+ (swap! settings conj entity)- :else- (swap! report update :seen conj (protocols/store-entity! writer entity))))+ :else+ (swap! report update :seen conj (protocols/store-entity! writer entity))))+ stream)(when (seq @settings)(protocols/store-settings! writer @settings)(swap! report update :seen conj [{:model "Setting"}]))