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" 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. + (