Skip to content

Instantly share code, notes, and snippets.

@srid
Created September 19, 2011 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save srid/1227251 to your computer and use it in GitHub Desktop.
Save srid/1227251 to your computer and use it in GitHub Desktop.
(defn update-running-deas
"Update the running-deas agent with new set of deas"
[curr]
(let [hosts (dea-hostnames)]
(loop [newhosts (remove curr hosts)
nxt curr]
(println "in loop")
(if (empty? newhosts)
(do
(println "Returning new agent value: " (keys nxt))
nxt)
(do
(println "Adding new host: " (first newhosts))
(recur (next newhosts)
(assoc nxt
(first newhosts)
(dea-tail-f (first newhosts)))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment