From 566fa9cb918c9cd0bfe46da7ee63e2ee96750d7e Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Sat, 1 Feb 2020 01:13:50 +0100 Subject: [PATCH] :sparkles: Improvements on backend application initialization. On repl and on production environment. --- backend/deps.edn | 3 --- backend/src/uxbox/main.clj | 13 +++++++------ backend/src/uxbox/tasks.clj | 3 ++- backend/tests/user.clj | 3 +-- common/uxbox/common/pages.cljc | 2 +- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/backend/deps.edn b/backend/deps.edn index 579535ec4..94800f5b6 100644 --- a/backend/deps.edn +++ b/backend/deps.edn @@ -60,9 +60,6 @@ mockery/mockery {:mvn/version "0.1.4"}} :extra-paths ["tests"]} - :repl - {:main-opts ["-m" "rebel-readline.main"]} - :tests {:extra-deps {lambdaisland/kaocha {:mvn/version "0.0-581"}} :main-opts ["-m" "kaocha.runner"]} diff --git a/backend/src/uxbox/main.clj b/backend/src/uxbox/main.clj index 8880c6d51..5e8a9e806 100644 --- a/backend/src/uxbox/main.clj +++ b/backend/src/uxbox/main.clj @@ -16,17 +16,18 @@ (let [m (System/getProperty "uxbox.enable-asserts")] (or (nil? m) (= "true" m)))) -;; Set value for current thread binding. -(set! *assert* (enable-asserts nil)) - ;; Set value for all new threads bindings. (alter-var-root #'*assert* enable-asserts) +;; Set value for current thread binding. +(set! *assert* (enable-asserts nil)) + ;; --- Entry point (defn -main [& args] - (load "uxbox/config" - "uxbox/migrations" - "uxbox/http") + (require 'uxbox.config + 'uxbox.migrations + 'uxbox.http + 'uxbox.tasks) (mount/start)) diff --git a/backend/src/uxbox/tasks.clj b/backend/src/uxbox/tasks.clj index c97ec8198..b1c346748 100644 --- a/backend/src/uxbox/tasks.clj +++ b/backend/src/uxbox/tasks.clj @@ -21,6 +21,7 @@ [uxbox.tasks.demo-gc] [uxbox.tasks.sendmail] [uxbox.tasks.impl :as impl] + [uxbox.util.time :as dt] [vertx.core :as vc] [vertx.timers :as vt])) @@ -49,7 +50,7 @@ (def ^:private schedule [{:id "every 1 hour" - :cron #uxbox/cron "1 1 */1 * * ? *" + :cron (dt/cron "1 1 */1 * * ? *") :fn #'uxbox.tasks.demo-gc/handler :props {:foo 1}}]) diff --git a/backend/tests/user.clj b/backend/tests/user.clj index cc0e26a9f..617867e15 100644 --- a/backend/tests/user.clj +++ b/backend/tests/user.clj @@ -19,8 +19,7 @@ [criterium.core :refer [quick-bench bench with-progress-reporting]] [promesa.core :as p] [promesa.exec :as pe] - [mount.core :as mount] - [uxbox.main])) + [mount.core :as mount])) ;; --- Benchmarking Tools diff --git a/common/uxbox/common/pages.cljc b/common/uxbox/common/pages.cljc index efd245882..f7ec01527 100644 --- a/common/uxbox/common/pages.cljc +++ b/common/uxbox/common/pages.cljc @@ -155,7 +155,7 @@ (defn process-changes [data items] - (->> (us/assert ::changes items) + (->> (us/verify ::changes items) (reduce process-change data))) (defn- process-change