Code related to tracking the progress of metabase initialization. This is kept in a separate, tiny namespace so it can be loaded right away when the application launches (and so we don't need to wait for metabase.core to load to check the status).

(ns metabase.core.initialization-status)
(defonce ^:private progress-atom
  (atom 0))

Is Metabase initialized and ready to be served?

(defn complete?
  []
  (= @progress-atom 1.0))

Get the current progress of Metabase initialization.

(defn progress
  []
  @progress-atom)

Update the Metabase initialization progress to a new value, a floating-point value between 0 and 1.

(defn set-progress!
  [^Float new-progress]
  {:pre [(float? new-progress) (<= 0.0 new-progress 1.0)]}
  (reset! progress-atom new-progress))

Complete the Metabase initialization by setting its progress to 100%.

(defn set-complete!
  []
  (set-progress! 1.0))