Skip to content

Instantly share code, notes, and snippets.

@bhagany
Created September 26, 2015 16:52
Show Gist options
  • Save bhagany/04f60177b40e792220fd to your computer and use it in GitHub Desktop.
Save bhagany/04f60177b40e792220fd to your computer and use it in GitHub Desktop.
(defrecord DatascriptS3Db [bucket key-name schema conn-ch conn]
component/Lifecycle
(start [this]
(let [conn-ch* (chan 1 (map (s3-obj->conn schema)))]
(pipe (u/get-obj-ch bucket key-name) conn-ch*)
(assoc this :conn-ch (go-loop
(if conn
conn
(<! conn-ch*))))))
(stop [this]
(-> this
(dissoc :conn-ch))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment