Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1 from xiaonaitong/master

some minor changes
  • Loading branch information...
commit dac07c188332ec45289e33e2be0bcd619777699c 2 parents bc3acab + f4e2fb7
@sunng87 authored
View
4 scripts/bench.clj
@@ -70,8 +70,8 @@
(.setDaemon t false)
(.start t)))
-(doall (map run-in-thread (take 5 (repeat producer))))
-(doall (map run-in-thread (take 10 (repeat worker))))
+(dorun (map run-in-thread (take 5 (repeat producer))))
+(dorun (map run-in-thread (take 10 (repeat worker))))
(run-in-thread monitor)
(println "benchmark started")
View
2  scripts/put.clj
@@ -41,6 +41,6 @@
(time
(do
- (doall (map run-in-thread (take total-clients (repeat do-put-jobs))))
+ (dorun (map run-in-thread (take total-clients (repeat do-put-jobs))))
(.await latch)))
View
7 src/clojalk/core.clj
@@ -126,8 +126,7 @@
(defn- set-job-as-ready [job]
(let [tube ((:tube job) @tubes)]
(do
- (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)))))
@@ -157,7 +156,7 @@
(let [session (@sessions id)]
(dosync
(dequeue-waiting-session session)
- (doall (map #(set-job-as-ready (@jobs %)) (:reserved_jobs @session)))
+ (dorun (map #(set-job-as-ready (@jobs %)) (:reserved_jobs @session)))
(alter sessions dissoc id))))
;; ## Macros for convenience of creating and executing commands
@@ -181,7 +180,7 @@
;; `put` is a producer task. It will create a new job according to information passed in.
;; When server is in drain mode, it does not store the job and return nil.
-;; If dealy is not zero, the job will be created as a delayed job. Delayed
+;; If delay is not zero, the job will be created as a delayed job. Delayed
;; job could not be reserved until it's timeout and ready.
(defcommand "put" [session priority delay ttr body]
(if-not @drain
View
2  src/clojalk/wal.clj
@@ -213,7 +213,7 @@
(if-let [bin-log-files (scan-dir *clojalk-log-dir*)]
(do
(dosync
- (doall (map #(read-file % replay-handler) bin-log-files))
+ (dorun (map #(read-file % replay-handler) bin-log-files))
(replay-tubes))
(println (str (count @clojalk.data/jobs) " jobs loaded from write-ahead logs."))
(update-id-counter)))
Please sign in to comment.
Something went wrong with that request. Please try again.