Skip to content

Commit

Permalink
Fix race condition (#24)
Browse files Browse the repository at this point in the history
* Fix race condition in debounced trigger
  • Loading branch information
neominik authored Jun 8, 2021
1 parent d0baf95 commit cf4ff29
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/superlifter/core.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@

(<= interval (- (js/Date.) lu))
(do (fetch-all-handling-errors! context bucket-id)
(reset! last-updated nil)
(compare-and-set! last-updated lu nil)
(js/setTimeout check-debounced 0 context bucket-id interval last-updated))

:else
Expand All @@ -158,7 +158,7 @@

(<= interval (- (System/currentTimeMillis) lu))
(do (fetch-all-handling-errors! context bucket-id)
(reset! last-updated nil)
(compare-and-set! last-updated lu nil)
(recur))

:else
Expand Down

0 comments on commit cf4ff29

Please sign in to comment.