Repository navigation
1.3.0: atomic database queue and global worker lock - #4
Merged
Merged
Conversation
- Database driver keeps jobs in {prefix}queue_jobs; pop() claims a row with a
conditional UPDATE, so parallel workers can neither lose nor repeat jobs
(the wp_options array was rewritten without locking and read through the
persistent object cache).
- 1.2.x jobs stored in wp_options are migrated on first use.
- One DB-row worker lock for all queues ({prefix}queue_locks), used by
wp_queue_process, REST process, wp queue work and the daemon.
- wp queue work --all --max-time for system cron.
- Daemon mode removes stale wp_queue_process events; dispatch() does not
spawn_cron() when DISABLE_WP_CRON is set.
- Payloads base64-encoded (PostgreSQL text rejects NUL bytes).
- Tests on a real SQL engine (SQLite): race between two workers, stale
reclaim, legacy migration, 4 parallel worker processes x 120 jobs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jobs of the database driver were kept in one wp_options array and rewritten without locking (and read through the persistent object cache). With parallel workers (WP-Cron + loopback + admin) jobs were lost and the same job ran dozens of times.
{prefix}queue_jobstable, pop() claims with a conditional UPDATE; 1.2.x option jobs migrated.wp queue work --all --max-time.wp_queue_processevents removed; no spawn_cron() with DISABLE_WP_CRON.