Skip to content

Commit

Permalink
webhook: Retry OSError on queue connection failure
Browse files Browse the repository at this point in the history
Commit 06c2717 introduced a retry loop for connecting to AMQP, as
these two containers start at the same time in the OpenShift deployment.

However, these days the webhook often fails with `ssl.SSLEOFError`
(with parents `SSLError` and `OSError`), which doesn't fit `AMQPError`.
So intercept this as well.

With that we can revert the static sleep from commit 169b53b
again.

Fixes #635
  • Loading branch information
martinpitt committed Dec 17, 2024
1 parent 66adbea commit 2bf1fe7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tasks/cockpit-tasks-webhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ spec:
ports:
- containerPort: 8080
protocol: TCP
command: [ "sh", "-ec", "sleep 10; exec webhook" ]
command: [ "webhook" ]
volumeMounts:
- name: webhook-secrets
mountPath: /run/secrets/webhook
Expand Down
2 changes: 1 addition & 1 deletion tasks/container/webhook
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def scan_tasks():
try:
with distributed_queue(AMQP_SERVER):
break
except pika.exceptions.AMQPError as e:
except (OSError, pika.exceptions.AMQPError) as e:
logging.info("Failed to connect to AMQP, attempt #%i: %s", retry, e)
time.sleep(5)

Expand Down

0 comments on commit 2bf1fe7

Please sign in to comment.