Send version and build data to worker configuration

This commit is contained in:
Andrey Antukh 2025-04-04 14:22:58 +02:00
parent 5cb39874a2
commit 6b3a988526
3 changed files with 20 additions and 10 deletions

View file

@ -17,8 +17,10 @@
[] []
(let [worker (uw/init cf/worker-uri err/on-error)] (let [worker (uw/init cf/worker-uri err/on-error)]
(uw/ask! worker {:cmd :configure (uw/ask! worker {:cmd :configure
:key :public-uri :config {:public-uri cf/public-uri
:val cf/public-uri}) :build-data cf/build-date
:version cf/version}})
(set! instance worker))) (set! instance worker)))
(defn ask! (defn ask!

View file

@ -135,15 +135,15 @@
(rx/debounce 1) (rx/debounce 1)
(rx/subs! (fn [[messages dropped last]] (rx/subs! (fn [[messages dropped last]]
;; Send back the dropped messages replies ;; Send back the dropped messages replies
(doseq [msg dropped] (doseq [msg dropped]
(drop-message msg)) (drop-message msg))
;; Process the message ;; Process the message
(doseq [msg (vals messages)] (doseq [msg (vals messages)]
(handle-message msg)) (handle-message msg))
;; After process the buffer we send a clear ;; After process the buffer we send a clear
(when-not (= last ::clear) (when-not (= last ::clear)
(rx/push! buffer ::clear))))))) (rx/push! buffer ::clear)))))))

View file

@ -50,8 +50,16 @@
(handler (assoc message :cmd :snaps/update-page-index)))) (handler (assoc message :cmd :snaps/update-page-index))))
(defmethod handler :configure (defmethod handler :configure
[{:keys [key val]}] [{:keys [config]}]
(log/info :hint "configure worker" :key key :val (dm/str val)) (log/info :hint "configure worker" :keys (keys config))
(case key
:public-uri (when-let [public-uri (get config :public-uri)]
(set! cf/public-uri val))) (set! cf/public-uri public-uri))
(when-let [version (get config :version)]
(set! cf/version version))
(when-let [build-date (get config :build-data)]
(set! cf/build-date build-date))
nil)