🔥 Remove app.common.time/duration usage on frontend (#7139)

Is broken and not necessary; duration class is no longer
available on frontend code.
This commit is contained in:
Andrey Antukh 2025-08-19 10:36:34 +02:00 committed by GitHub
parent 4237ef572e
commit f4be117219
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 15 deletions

View File

@ -119,9 +119,9 @@
[o] [o]
(instance? Duration o))) (instance? Duration o)))
(defn duration #?(:clj
[ms-or-obj] (defn duration
#?(:clj [ms-or-obj]
(cond (cond
(string? ms-or-obj) (string? ms-or-obj)
(Duration/parse (str "PT" ms-or-obj)) (Duration/parse (str "PT" ms-or-obj))
@ -134,10 +134,7 @@
(Duration/ofMillis ms-or-obj) (Duration/ofMillis ms-or-obj)
:else :else
(obj->duration ms-or-obj)) (obj->duration ms-or-obj))))
:cljs
(clj->js ms-or-obj)))
#?(:clj #?(:clj
(defn parse-duration (defn parse-duration
@ -292,7 +289,7 @@
(defn plus (defn plus
[d ta] [d ta]
(let [ta (duration ta)] (let [ta #?(:clj (duration ta) :cljs ta)]
(cond (cond
#?@(:clj [(duration? d) (.plus ^Duration d ^TemporalAmount ta)]) #?@(:clj [(duration? d) (.plus ^Duration d ^TemporalAmount ta)])
@ -307,7 +304,7 @@
(defn minus (defn minus
[d ta] [d ta]
(let [^TemporalAmount ta (duration ta)] (let [ta #?(:clj (duration ta) :cljs ta)]
(cond (cond
#?@(:clj [(duration? d) (.minus ^Duration d ^TemporalAmount ta)]) #?@(:clj [(duration? d) (.minus ^Duration d ^TemporalAmount ta)])

View File

@ -31,9 +31,8 @@
;; Defines the maximum number of events that can go in a single batch. ;; Defines the maximum number of events that can go in a single batch.
(def max-chunk-size 100) (def max-chunk-size 100)
;; Defines the time window within events belong to the same session. ;; Defines the time window (in ms) within events belong to the same session.
(def session-timeout (def session-timeout (* 1000 60 30))
(ct/duration {:minutes 30}))
;; --- CONTEXT ;; --- CONTEXT
@ -248,7 +247,7 @@
(l/debug :hint "event enqueued") (l/debug :hint "event enqueued")
(swap! buffer append-to-buffer event))) (swap! buffer append-to-buffer event)))
(rx/switch-map #(rx/timer (inst-ms session-timeout))) (rx/switch-map #(rx/timer session-timeout))
(rx/take-until stopper) (rx/take-until stopper)
(rx/subs! (fn [_] (rx/subs! (fn [_]
(l/debug :hint "session reinitialized") (l/debug :hint "session reinitialized")

View File

@ -8,7 +8,6 @@
"A http client with rx streams interface." "A http client with rx streams interface."
(:require (:require
[app.common.data :as d] [app.common.data :as d]
[app.common.time :as ct]
[app.common.transit :as t] [app.common.transit :as t]
[app.common.uri :as u] [app.common.uri :as u]
[app.config :as cfg] [app.config :as cfg]
@ -215,4 +214,4 @@
:uri url :uri url
:response-type :text}) :response-type :text})
(rx/map :body) (rx/map :body)
(c/with-cache {:key url :max-age (ct/duration {:hours 4})}))) (c/with-cache {:key url :max-age (* 1000 60 60 4)})))