Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically retry ping if OhDear had downtime #54

Merged
merged 2 commits into from
Aug 2, 2021

Conversation

patrickbrouwers
Copy link
Contributor

@patrickbrouwers patrickbrouwers commented Jul 31, 2021

Issue

Yesterday and today I had 5 pings failing due to a 500 Internal server error on OhDear side.

  • 30-07-2021: 19:00 (Europe/Amsterdam)
  • 31-07-2021 06:00 (2x), 15:00, 21:00 (Europe/Amsterdam)

As reference the OhDear ids: sites/16574/checks/97683/cron/4337

I have just retried them via Horizon and then they get accepted. (However as I noticed it too late, OhDear has marked the cron as failed). My queuing setup on this project is very simple, so there's only 1 attempt at running the job.

Possible solution

To not depend on user land queue settings, it might be good to leverage the Laravel Http client's build in retry() method. I've set it to 3 retries with a 10 second delay in between, but you might be a better judge of the numbers that would work better based on how long the above described 500 errors lasted.

Alternatives

As jobs have a default timeout, long downtimes wouldn't be tackled with just retrying the request. A backoff strategy (https://laravel.com/docs/8.x/queues#dealing-with-failed-jobs) could be used as well. If you would prefer that approach (or a combination), I'm happy to update the PR to that.

@freekmurze freekmurze merged commit 244b003 into spatie:main Aug 2, 2021
@freekmurze
Copy link
Member

Thank you!

@patrickbrouwers patrickbrouwers deleted the patch-1 branch August 2, 2021 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants