Skip to content

Commit

Permalink
Time events
Browse files Browse the repository at this point in the history
  • Loading branch information
klauswuestefeld committed Mar 28, 2024
1 parent bf87457 commit c74a473
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/prevayler_clj_aws/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
_ (println "Read" (count items) "items. last-key:" last-key)]

(lazy-cat
(map (comp unmarshal :B :content tap #(tap-millis % "Item processed")) items)
(map (comp unmarshal :B :content tap #(tap-millis % "Item consumed by map")) items)
(if (seq last-key)
(read-page last-key)
[]))))]
Expand All @@ -90,7 +90,9 @@
(defn- restore-events! [dynamo-cli handler state-atom table partkey page-size]
(let [items (read-items dynamo-cli table partkey page-size)]
(doseq [[timestamp event expected-state-hash] items]
(let [state (swap! state-atom handler event timestamp)]
(let [_ (tap-millis nil "Before handler")
state (swap! state-atom handler event timestamp)
_ (tap-millis nil "Event handled")]
(when (and expected-state-hash ; Old journals don't have this state hash saved (2023-10-25)
(not= (hash state) expected-state-hash))
(println "Inconsistent state detected after restoring event:\n" event)
Expand Down

0 comments on commit c74a473

Please sign in to comment.