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
[perf] Fix a sneaky infinite loop in a prod-only error case (#66955)
Braden Shepherdsonf248bb4669e0
diff --git a/src/metabase/lib/metadata/result_metadata.cljc b/src/metabase/lib/metadata/result_metadata.cljcindex 4a0d81ca202..e2c1e5dae5a 100644--- a/src/metabase/lib/metadata/result_metadata.cljc+++ b/src/metabase/lib/metadata/result_metadata.cljc@@ -118,7 +118,8 @@(log/error e)(mapv merge-colinitial-cols- (concat lib-cols (repeat nil))))+ ;; `util.perf/mapv` checks the `count` of all args, so it's NSFIS - Not Safe For Infinite Seqs.+ (take (count initial-cols) (concat lib-cols (repeat nil)))))(throw e)))))(mu/defn- legacy-source :- ::lib.schema.metadata/column.legacy-sourcediff --git a/src/metabase/util/performance.cljc b/src/metabase/util/performance.cljcindex 7e837d40a97..4bebdb3ff99 100644--- a/src/metabase/util/performance.cljc+++ b/src/metabase/util/performance.cljc@@ -198,9 +198,12 @@(^long [c1 c2 c3 c4] (min (count c1) (count c2) (count c3) (count c4)))))(defn mapv- "Drop-in replacement for `clojure.core/mapv`.+ "**Nearly** drop-in replacement for `clojure.core/mapv`.+Iterates multiple collections more efficiently and uses Java iterators under the hood (the CLJ version). CLJS- version is only optimized for a single collection arity."+ version is only optimized for a single collection arity.++ Checks the `count` of all inputs - DO NOT give this infinite sequences!"([f coll1](let [n (count coll1)](cond (= n 0) []