Skip to content

Instantly share code, notes, and snippets.

@ashafa
Created March 8, 2010 16:41
Show Gist options
  • Save ashafa/325335 to your computer and use it in GitHub Desktop.
Save ashafa/325335 to your computer and use it in GitHub Desktop.
(defn wait-for-changes
[& _]
(let [update-seq (:update_seq (database-info "test-changes"))]
(with-open [is (with-db "test-changes"
(couchdb-request (assoc config :read-json-response false)
:get (str "_changes?feed=continuous&heartbeat=5000&since=" update-seq)))]
(loop [lines (io/read-lines is)]
(if-let [line (first lines)]
line
(recur lines))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment