Skip to content

Fix schedule hooks firing when timestamp <= now - #817

Open
top-sigrid wants to merge 1 commit into
resque:masterfrom
top-sigrid:fix-schedule-hooks-for-past-times
Open

top-sigrid wants to merge 1 commit into
resque:masterfrom
top-sigrid:fix-schedule-hooks-for-past-times

Conversation

@top-sigrid

Copy link
Copy Markdown
Contributor

When enqueue_at is called with a timestamp in the past or equal to now, the job bypasses the delayed queue and goes directly to the work queue. Previously, before_schedule and after_schedule hooks were incorrectly called in this case.

This fix moves process_schedule_hooks inside the else branch so hooks only fire when jobs actually enter the delayed queue.

Fixes #816

@PatrickTulskie

Copy link
Copy Markdown
Member

@top-sigrid I think this is fine to merge, but it could use a rebase. Mind rebasing on master, pushing it up and let's see if CI passes.

@top-sigrid

Copy link
Copy Markdown
Contributor Author

Hi Patrick, thanks for getting back to this! I can definitely do that, will find the time very soon. Probably a good idea to do this for my other PRs aswell :)

@PatrickTulskie

Copy link
Copy Markdown
Member

@top-sigrid oh yeah actually you're right there are a few that we can probably merge in once they are rebased. I'm aiming to get a few resque releases out around mid-month. If we can get them in before that they'll make the release. Holler when you want me to check them!

@top-sigrid
top-sigrid force-pushed the fix-schedule-hooks-for-past-times branch from ed70e27 to f772cb4 Compare July 23, 2026 15:30
@top-sigrid

Copy link
Copy Markdown
Contributor Author

Hi @PatrickTulskie I finally found the time to dedicate some time to this again. This one is rebased and the CI passes so should be fine. Let me know if you have any further wishes or review :)

@PatrickTulskie PatrickTulskie added this to the v5.1.0 milestone Sep 24, 2026
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.

schedule hooks fire when timestamp is <= now, although jobs bypass the delayed queue entirely in that case

2 participants