-
Notifications
You must be signed in to change notification settings - Fork 82
Migration: Re-use async batch infrastructure #1343
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
base: trunk
Are you sure you want to change the base?
Conversation
@obenland what about this PR? |
Depends on #1521. |
@pfefferle This should be ready for review |
After team call: Let's make it possible to fill the Scheduler from Meaning, how can we expand the batch callback allow list from the migration class. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors migration jobs to reuse the existing Scheduler::async_batch infrastructure instead of having their own dedicated scheduling system. The changes consolidate job scheduling through a unified batch processing system.
Key changes:
- Removes custom migration scheduling methods and replaces them with async_batch infrastructure
- Updates test coverage to reflect the new scheduling approach
- Simplifies the migration job architecture by eliminating duplicate scheduling logic
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
includes/class-migration.php | Removes async_migration and async_upgrade methods, updates migration scheduling to use async_batch |
includes/class-scheduler.php | Adds migration callbacks to batch_callbacks array and registers corresponding action hooks |
tests/includes/class-test-migration.php | Updates tests to use new Scheduler::async_batch approach and removes old migration-specific tests |
tests/includes/class-test-scheduler.php | Adds new tests for migration functionality using the async_batch infrastructure |
Comments suppressed due to low confidence (1)
tests/includes/class-test-migration.php:1
- Inconsistent factory usage. Line 381 uses
self::factory()->post->create()
while line 481 uses$this->factory->post->create()
. Should use the same pattern throughout the file.
<?php
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…system * Add Scheduler::register_async_batch_callback() method for dynamic callback registration * Remove hardcoded Migration callbacks from Scheduler class * Update Migration class to register its callbacks through new system * Add safety check to ensure callbacks are registered at proper time * Maintain backward compatibility - async_batch works exactly the same way * Enable any class to add async batch jobs without modifying core files
Moves async batch callback registration for activity sending and retrying from Scheduler's static property to Dispatcher initialization. Updates _doing_it_wrong message version to 'unreleased' for clarity.
9c44a63
to
681aa0c
Compare
# Conflicts: # tests/includes/class-test-migration.php # tests/includes/class-test-scheduler.php
Co-authored-by: Matthias Pfefferle <[email protected]>
Proposed changes:
Scheduler::register_async_batch_callback()
method for dynamic callback registrationasync_batch
works exactly the same wayOther information:
Testing instructions:
Usage for other plugins/classes:
Any class can now register async batch jobs without modifying core files:
Changelog entry
Changelog Entry Details
Significance
Type
Message
Add extensible async batch callback registration system to replace hardcoded allowlist