diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2018-03-08 23:06:12 -0300 |
---|---|---|
committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2018-03-08 23:06:12 -0300 |
commit | de7cd8220c364dd816f4136a9d4c5a4d6618359d (patch) | |
tree | 8de2745e1d6d63d020330ad71f8bc6fe5e37db08 /src/clj/queue_api/db/core.clj | |
parent | b9e1725e4f9bebce7e426431a1f8524efd026662 (diff) | |
download | queue-api-de7cd8220c364dd816f4136a9d4c5a4d6618359d.tar.gz queue-api-de7cd8220c364dd816f4136a9d4c5a4d6618359d.tar.bz2 queue-api-de7cd8220c364dd816f4136a9d4c5a4d6618359d.zip |
Better routing and mutex
Diffstat (limited to 'src/clj/queue_api/db/core.clj')
-rw-r--r-- | src/clj/queue_api/db/core.clj | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/clj/queue_api/db/core.clj b/src/clj/queue_api/db/core.clj index adbda25..0ad9b81 100644 --- a/src/clj/queue_api/db/core.clj +++ b/src/clj/queue_api/db/core.clj @@ -156,7 +156,8 @@ [^String id] (let [a (d/entity @conn [:agent/id id])] (if-not (nil? a) - (let [jid (:job/id (fittest-job id))] - (end-job a) - (start-job id jid) - jid))))
\ No newline at end of file + (locking (Object.) + (let [jid (:job/id (fittest-job id))] + (end-job a) + (start-job id jid) + jid)))))
\ No newline at end of file |