Fix id->message-id

This commit is contained in:
janherich 2018-01-12 16:16:55 +01:00 committed by Oskar Thoren
parent 24d0b68c1f
commit 2f6742cdc7
No known key found for this signature in database
GPG Key ID: 5128AB0637CD85AF
1 changed files with 5 additions and 5 deletions

View File

@ -24,16 +24,16 @@
mature-ch (async/chan)
seen (atom #{})]
(async/go-loop []
(let [{:keys [id clock-value] :as msg} (async/<! in-ch)]
(swap! seen conj [clock-value id])
(let [{:keys [message-id clock-value] :as msg} (async/<! in-ch)]
(swap! seen conj [clock-value message-id])
(async/<! (async/timeout delay-ms))
(async/put! mature-ch msg))
(recur))
(async/go-loop []
(let [{:keys [id clock-value] :as msg} (async/<! mature-ch)]
(let [{:keys [message-id clock-value] :as msg} (async/<! mature-ch)]
(if reorder?
(if (earliest-clock-value-seen? @seen id clock-value)
(do (swap! seen disj [clock-value id])
(if (earliest-clock-value-seen? @seen message-id clock-value)
(do (swap! seen disj [clock-value message-id])
(add-fn msg))
(async/put! mature-ch msg))
(add-fn msg)))