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

Delay queue push #18

Merged
merged 1 commit into from
Nov 28, 2023
Merged

Delay queue push #18

merged 1 commit into from
Nov 28, 2023

Conversation

timkelty
Copy link
Collaborator

Description

Fix missed jobs by delaying queue push until onAfterRequest.

*
* Priority is not supported by SQS
*/
return parent::pushMessage($message, (string) $ttr, $delay, null);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See any trouble with passing null for priority? SQS doesn't support it, so we have to.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine. But also a good reason to move away from SQS down the road.

* the job will exist and be indefinitely pending.
*/
Craft::$app->onAfterRequest(function() use ($message, $ttr, $delay) {

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brandonkelly are you sure we shouldn't do a last check to ensure we're not in a transaction?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anything doing stuff that requires a transaction at this point is doing it wrong.

@timkelty timkelty self-assigned this Nov 28, 2023
@timkelty timkelty merged commit 694f57d into main Nov 28, 2023
4 of 5 checks passed
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