Browse files

fnil can handle nonexist key when update-in

  • Loading branch information...
xiaonaitong committed Oct 12, 2011
1 parent 400342f commit f4e2fb756e2aef3d672f9d9240b09359725efb66
Showing with 1 addition and 2 deletions.
  1. +1 −2 src/clojalk/core.clj
@@ -126,8 +126,7 @@
(defn- set-job-as-ready [job]
(let [tube ((:tube job) @tubes)]
- (alter jobs assoc (:id job) (assoc job :state :ready))
-; (alter jobs update-in [(:id job)] assoc :state :ready)
+ (alter jobs update-in [(:id job)] (fnil assoc job) :state :ready)
(alter (:ready_set tube) conj job)
(if-let [s (first @(:waiting_list tube))]
(reserve-job s job)))))

0 comments on commit f4e2fb7

Please sign in to comment.