-
Notifications
You must be signed in to change notification settings - Fork 84
Add configurable retry and batch pause constants #2360
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
Conversation
Introduces ACTIVITYPUB_OUTBOX_RETRY_MAX_ATTEMPTS, ACTIVITYPUB_OUTBOX_RETRY_DELAY_UNIT, and ACTIVITYPUB_ASYNC_BATCH_PAUSE constants for improved control over retry logic and async batch scheduling. Updates Dispatcher and Scheduler classes to use these new constants for retries and batch pauses.
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 adds three new configurable constants to improve control over ActivityPub outbox retry logic and async batch scheduling, addressing traffic peak handling when federating new posts. The constants allow customization of retry attempts, retry delays, and pause intervals between async batches.
Key changes:
- Introduces three new constants:
ACTIVITYPUB_OUTBOX_RETRY_MAX_ATTEMPTS,ACTIVITYPUB_OUTBOX_RETRY_DELAY_UNIT, andACTIVITYPUB_ASYNC_BATCH_PAUSE - Updates Dispatcher and Scheduler classes to use configurable static properties instead of hardcoded values
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| includes/constants.php | Defines three new constants for retry attempts (3), retry delay unit (1 hour), and async batch pause (30 seconds) |
| includes/class-scheduler.php | Adds static property for async batch pause and uses it instead of hardcoded 30-second value |
| includes/class-dispatcher.php | Adds static properties for retry max attempts and retry delay unit, replacing hardcoded values in retry logic |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
@obenland I know that you are not a fan of consts, but that is how the rest works, so I tried to be consistent. Happy to change the whole system to use filters and/or options instead. |
|
Filters are probably the most flexible approach |
Replaces direct usage of constants and static properties for batch size, retry attempts, delay unit, error codes, and async batch pause with getter methods that apply WordPress filters. This improves flexibility and allows these values to be customized via hooks. Removes related constants from constants.php.
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
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Konstantin Obenland <[email protected]>
Co-authored-by: Konstantin Obenland <[email protected]>
Updated Dispatcher to use ACTIVITYPUB_OUTBOX_PROCESSING_BATCH_SIZE as the default batch size. Renamed Scheduler's get_async_batch_pause() to get_retry_delay() and updated references to improve clarity and consistency in batch processing and scheduling.
Replaces the use of get_retry_delay_unit() with get_retry_delay() in the retry scheduling logic to ensure the correct delay value is applied for activity retries.
|
Today was not mAI day :( |
Added new configuration options to better manage traffic spikes when federating posts, allowing finer control over retry limits, delays, and batch pauses.
Proposed changes:
Other information:
Testing instructions:
Changelog entry
Changelog Entry Details
Significance
Type
Message
Added new configuration options to better manage traffic spikes when federating posts, allowing finer control over retry limits, delays, and batch pauses.