Skip to content

Commit

Permalink
destructures properly
Browse files Browse the repository at this point in the history
  • Loading branch information
NBKelly committed Oct 4, 2024
1 parent 4b6bf3d commit b01e061
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/clj/web/app_state.clj
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
(swap! app-state assoc-in [:lobby-updates uid] (inst/now)))

(defn receive-lobby-updates?
"checks if a user receives lobby updates, and updates the state if they've timed out to amortize subsequent checks. Mutates"
[uid]
(if-let [last-ping (get-in @app-state [:lobby-updates uid])]
(if (.isBefore (inst/now) (inst/plus last-ping lobby-subs-timeout-hours chrono/hours))
Expand All @@ -84,5 +85,5 @@
(defonce cleanup-lobby-subs
(go (while true
(<! (timeout lobby-subs-clearout-freq))
(doseq [[uid] (get-users)]
(doseq [{uid :uid} (vals (:users @app-state))]
(receive-lobby-updates? uid)))))

0 comments on commit b01e061

Please sign in to comment.