File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change 7878(defn tweet!
7979 [message token]
8080 (timbre/info " tweeting" message)
81- ; ; XXX this might want a timeout value
8281 (md/future
8382 (tw-api/statuses-update :oauth-creds token
8483 :params {:status message})))
9594 (let [{s0 :alarm-state token :token } ctx
9695 s1 (red-alert? statuses)
9796 tweet-status (get-next-state s0 s1)]
98- (tweet-alert! token tweet-status)
99- (-> ctx
100- ; ; why not set the state to a keyword ::bad ::good
101- (assoc :alarm-state s1)
102- (assoc :last-update (time/now )))))
97+ (md/chain
98+ (tweet-alert! token tweet-status)
99+ (fn [& args]
100+ (-> ctx
101+ (assoc :alarm-state s1)
102+ (assoc :last-update (time/now )))))))
103103
104104(defn run-world!
105105 []
106106 (md/let-flow [statuses (get-parse-statuses! )]
107- (reset! state (alert! @state statuses))
108- (timbre/info " current state" (:alarm-state @state))))
107+ (md/chain
108+ (alert! @state statuses)
109+ (fn [new-world]
110+ (reset! state new-world)
111+ (timbre/info " current state of the world" (:alarm-state @state))))))
109112
110113(defn keep-checking
111114 [period]
You can’t perform that action at this time.
0 commit comments