Skip to content

Commit

Permalink
Make it possible to stop just the conn-pool
Browse files Browse the repository at this point in the history
  • Loading branch information
apa512 committed Feb 27, 2019
1 parent 8ff6e8d commit 66e8467
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: '3'
services:
faktory:
image: contribsys/faktory:0.9.6
ports:
- "7419:7419"
- "7420:7420"
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject com.apa512/clj-faktory "0.2.9"
(defproject com.apa512/clj-faktory "0.2.10"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
Expand Down
10 changes: 6 additions & 4 deletions src/clj_faktory/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,17 @@
heartbeat
TimeUnit/MILLISECONDS)))

(defn stop [{:keys [conn-pool worker-pool :as worker-manager]}]
(defn stop [{:keys [conn-pool prio-pool worker-pool :as worker-manager]}]
(try
(when-not (.awaitTermination worker-pool 2000 TimeUnit/MILLISECONDS)
(.shutdownNow worker-pool))
(when worker-pool
(when-not (.awaitTermination worker-pool 2000 TimeUnit/MILLISECONDS)
(.shutdownNow worker-pool)))
(catch InterruptedException e
(log/debug e)
(.shutdownNow worker-pool))
(finally
(pool/close conn-pool)))
(pool/close conn-pool)
(pool/close prio-pool)))
worker-manager)

(defn start [{:keys [worker-pool concurrency] :as worker-manager}]
Expand Down

0 comments on commit 66e8467

Please sign in to comment.