diff --git a/project.clj b/project.clj index eaf96bf2ab53b02b38dbbc50b71b41d827e84a70..7ed1041e0fe2c3c2dd056517becfc4630c76ea51 100644 --- a/project.clj +++ b/project.clj @@ -60,7 +60,7 @@ :javac-options ["-target" "1.6" "-source" "1.6"] :uberjar-name "metabase.jar" :ring {:handler metabase.core/app - :init metabase.core/init + :init metabase.core/init! :destroy metabase.core/destroy} :eastwood {:exclude-namespaces [:test-paths] :add-linters [:unused-private-vars] diff --git a/src/metabase/core.clj b/src/metabase/core.clj index 9d62ef74175ddcf72bdbf488305820f4c92b5c72..c51a6d8423905b9c064dd2fa6157d8bb16f3d84b 100644 --- a/src/metabase/core.clj +++ b/src/metabase/core.clj @@ -113,7 +113,7 @@ (task/stop-scheduler!) (log/info "Metabase Shutdown COMPLETE")) -(defn init +(defn init! "General application initialization function which should be run once at application startup." [] (log/info (format "Starting Metabase version %s..." (config/mb-version-string))) @@ -125,6 +125,7 @@ ;; Load up all of our Database drivers, which are used for app db work (driver/find-and-load-drivers!) + (reset! metabase-initialization-progress 0.4) ;; startup database. validates connection & runs any necessary migrations (db/setup-db :auto-migrate (config/config-bool :mb-db-automigrate)) @@ -157,9 +158,8 @@ ;; otherwise update if appropriate (sample-data/update-sample-dataset-if-needed!))) - (log/info "Metabase Initialization COMPLETE") (initialization-complete!) - true) + (log/info "Metabase Initialization COMPLETE")) ;;; ## ---------------------------------------- Jetty (Web) Server ---------------------------------------- @@ -209,13 +209,14 @@ ;; launch embedded webserver async (start-jetty) ;; run our initialization process - (init) + (init!) ;; Ok, now block forever while Jetty does its thing (when (config/config-bool :mb-jetty-join) (.join ^org.eclipse.jetty.server.Server @jetty-instance)) (catch Exception e (.printStackTrace e) - (log/error "Metabase Initialization FAILED: " (.getMessage e))))) + (log/error "Metabase Initialization FAILED: " (.getMessage e)) + (System/exit 1)))) (defn- run-cmd [cmd & args] (let [cmd->fn {:migrate (fn [direction]