Skip to content

Scheduler: Process batches for individual hooks #1521

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

Open
wants to merge 14 commits into
base: trunk
Choose a base branch
from

Conversation

obenland
Copy link
Member

@obenland obenland commented Mar 28, 2025

Proposed changes:

  • Adds specific event hooks for sending outbox items to followers and retries.
  • Adds back-compat to existing events that still pass an event callback.
  • Makes checks for existing jobs post-specific, since that's now possible.
  • Removes next_scheduled_hook() method, as it is no longer used.
  • Updates unit test.

Other information:

  • Have you written new tests for your changes, if applicable?

Testing instructions:

  • Update a post, create a comment, or update your user profile.
  • Trigger registered events: npm run env -- run cli wp cron event run --all
  • Make sure there are no errors or warnings and Outbox items still get processed as expected.
  • Switch to trunk and generate events with the old signature (I defined ACTIVITYPUB_OUTBOX_PROCESSING_BATCH_SIZE = 1 to trigger batching)
  • With events with the old signature scheduled, switch to this branch and run the events.

Changelog entry

  • Automatically create a changelog entry from the details below.
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Added - for new features
  • Changed - for changes in existing functionality
  • Deprecated - for soon-to-be removed features
  • Removed - for now removed features
  • Fixed - for any bug fixes
  • Security - in case of vulnerabilities

Message

Batch processing jobs can now be scheduled with individual hooks.

@obenland obenland requested a review from a team March 28, 2025 17:48
@obenland obenland self-assigned this Mar 28, 2025
@obenland
Copy link
Member Author

First pass. It'll need a bit more testing.

@obenland obenland marked this pull request as ready for review March 31, 2025 16:45
@pfefferle
Copy link
Member

I will run some tests on my live system tomorrow morning.

@pfefferle
Copy link
Member

pfefferle commented Apr 4, 2025

I have the same issue when "flooding" the db with comments. It seems that only 2 of 5 to 7 comments will be queued properly. If I trigger the activitypub_reprocess_outbox process afterwards, all comments will be queued properly and also sent to all followers.

Might there be a flood control mechanism that still interferes somehow?

@obenland
Copy link
Member Author

obenland commented Apr 4, 2025

Yeah, I wouldn't expect this PR to help with that directly. But it should help with more fine-grain control over identifying specific jobs

@pfefferle
Copy link
Member

Except from the flooding issue, everything seems to work as before... Have to check the retries though... I have no broken followers on my second blog 🫣

@pfefferle
Copy link
Member

I have some really weird experiences on my live system. Have to observe that a bit.

@pfefferle pfefferle force-pushed the try/hook-specific-batching branch from 4c06690 to 0b36dc1 Compare April 10, 2025 15:31
@github-actions github-actions bot added [Block] Federated reply Respond to posts, notes, videos, and other content on the fediverse. [Block] Follow Me labels Apr 10, 2025
@github-actions github-actions bot added [Feature] WP Admin [Focus] Editor Changes to the ActivityPub experience in the block editor labels Apr 10, 2025
@pfefferle pfefferle force-pushed the try/hook-specific-batching branch from 0b36dc1 to 8b236f7 Compare April 10, 2025 15:32
@pfefferle
Copy link
Member

pfefferle commented Apr 10, 2025

Removed my changes... will think about logging in general...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Federated reply Respond to posts, notes, videos, and other content on the fediverse. [Block] Follow Me [Feature] Collections [Feature] WP Admin [Focus] Editor Changes to the ActivityPub experience in the block editor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants