Permalink
Browse files

clean up queues in finally, and better q names

  • Loading branch information...
1 parent 48001bc commit 6cfd493830302161bf5d5aa11ca486bfbcc29e50 @amitrathore committed Aug 2, 2010
@@ -102,15 +102,15 @@
([swarm-requests allowed-time]
(wait-until-completion swarm-requests allowed-time throw-exception))
([swarm-requests allowed-time error-fn]
- (loop [all-complete (all-complete? swarm-requests) elapsed-time 0]
- (if (> elapsed-time allowed-time)
- (do
- (disconnect-all swarm-requests)
- (error-fn allowed-time))
- (if (not all-complete)
- (do
- (Thread/sleep 100)
- (recur (all-complete? swarm-requests) (+ elapsed-time 100))))))))
+ (try
+ (loop [all-complete (all-complete? swarm-requests) elapsed-time 0]
+ (if (> elapsed-time allowed-time)
+ (error-fn allowed-time)
+ (when-not all-complete
+ (Thread/sleep 100)
+ (recur (all-complete? swarm-requests) (+ elapsed-time 100)))))
+ (finally
+ (disconnect-all swarm-requests)))))
(defn wait-until-completion-no-exception
[swarm-requests allowed-time]
@@ -16,7 +16,7 @@
:sevak-service-args args})
(defn sevak-queue-message-for-return [sevak-service args]
- (assoc (sevak-queue-message-no-return sevak-service args) :return-queue-name (return-queue-name)))
+ (assoc (sevak-queue-message-no-return sevak-service args) :return-queue-name (return-queue-name sevak-service)))
(defn register-callback [return-q-name custom-handler request-object]
(init-medusa 140)
@@ -8,8 +8,8 @@
(defn random-uuid []
(str (UUID/randomUUID)))
-(defn return-queue-name []
- (random-uuid))
+(defn return-queue-name [sevak-name]
+ (str (System/currentTimeMillis) "_" sevak-name "_" (random-uuid)))
(defn random-queue-name []
(random-uuid))

0 comments on commit 6cfd493

Please sign in to comment.