Skip to content

Commit

Permalink
Display last item to unmarshal every 15 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
klauswuestefeld committed Mar 28, 2024
1 parent 21cb08d commit 1b35b94
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/prevayler_clj_aws/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@
base64/encode-bytes
String.))

(defn- tap-count [^bytes ba]
(println "Length:" (count ba))
ba)

(defn- unmarshal [in]
(-> (with-open [out (ByteArrayOutputStream.)]
(io/copy in out)
(.toByteArray out))
tap-count
base64/decode-bytes
nippy/thaw))

Expand All @@ -44,9 +49,8 @@
:Key snapshot-path
:Body (marshal snapshot)}}))

(def stored-item (atom nil))
(defn- store-item [v]
(reset! stored-item v)
(defn- tap [v]
(println v)
v)

(defn- read-items [dynamo-cli table partkey page-size]
Expand All @@ -64,7 +68,7 @@
_ (println "Read" (count items) "items. last-key:" last-key)]

(lazy-cat
(map (comp unmarshal :B :content store-item) items)
(map (comp unmarshal :B :content tap) items)
(if (seq last-key)
(read-page last-key)
[]))))]
Expand Down

0 comments on commit 1b35b94

Please sign in to comment.