mirror of
https://github.com/penpot/penpot.git
synced 2025-02-13 10:38:13 -05:00
💄 Improve code of vertx timers ns.
This commit is contained in:
parent
e4c9d29b69
commit
9bcb91ceae
1 changed files with 9 additions and 9 deletions
18
backend/vendor/vertx/src/vertx/timers.clj
vendored
18
backend/vendor/vertx/src/vertx/timers.clj
vendored
|
@ -58,19 +58,19 @@
|
|||
state (atom nil)
|
||||
taskfn (fn wrapped-task []
|
||||
(-> (p/do! ((::fn opts) opts))
|
||||
(p/catch' (constantly nil)) ; explicitly ignore all errors
|
||||
(p/catch' (constantly nil)) ; explicitly ignore all errors
|
||||
(p/then' (fn [_] ; the user needs to catch errors
|
||||
(when repeat
|
||||
(if repeat
|
||||
(let [tid (schedule-once! vsm delay wrapped-task)]
|
||||
(reset! state tid)
|
||||
nil))))))
|
||||
tid (schedule-once! vsm delay taskfn)]
|
||||
(reset! state tid)
|
||||
nil))
|
||||
(do
|
||||
(reset! state nil)
|
||||
nil)))))
|
||||
tid (reset! state (schedule-once! vsm delay taskfn))]
|
||||
(reify
|
||||
java.lang.AutoCloseable
|
||||
(close [this]
|
||||
(locking this
|
||||
(when-let [timer-id (deref state)]
|
||||
(.cancelTimer system timer-id)
|
||||
(reset! state nil)))))))
|
||||
(when (compare-and-set! state tid nil)
|
||||
(.cancelTimer system tid))))))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue