From 9de6370e7363978a936f226f252be28489561d4d Mon Sep 17 00:00:00 2001 From: Paul Lam Date: Thu, 13 Sep 2018 20:15:58 +0900 Subject: [PATCH 1/2] set patch version --- project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.clj b/project.clj index 5ac74ab..037ba37 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject motiva/sqs-utils "0.3.0-SNAPSHOT" +(defproject motiva/sqs-utils "0.2.3-SNAPSHOT" :description "Higher level SQS utilities for use in Motiva products" :url "https://github.com/Motiva-AI/sqs-utils" :license {:name "MIT License" From 2e622f5d882903a86480cbd535e138edabdc489d Mon Sep 17 00:00:00 2001 From: Paul Lam Date: Thu, 13 Sep 2018 20:14:59 +0900 Subject: [PATCH 2/2] add a restart delay --- src/sqs_utils/core.clj | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/sqs_utils/core.clj b/src/sqs_utils/core.clj index bfa33c0..46623dc 100644 --- a/src/sqs_utils/core.clj +++ b/src/sqs_utils/core.clj @@ -51,9 +51,10 @@ ([sqs-config queue-url out-chan] (receive-loop! sqs-config queue-url out-chan {})) - ([sqs-config queue-url out-chan {:keys [auto-delete visibility-timeout] - :or {auto-delete true - visibility-timeout 60} + ([sqs-config queue-url out-chan {:keys [auto-delete visibility-timeout restart-delay-seconds] + :or {auto-delete true + visibility-timeout 60 + restart-delay-seconds 1} :as opts}] (let [loop-state (atom {:messages (sqs.channeled/receive! @@ -124,6 +125,10 @@ (log/warn message "Received an error from fink-nottle" (assoc stats :last-wait-duration (secs-between this-pass-started-at (t/now)))) + ;; Adding a restart delay so that this doesn't go into an + ;; infinite loop if the queue listener is failing to start + ;; continuously. + (