Skip to content
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

Update Dispatcher to use Outbox #1186

Open
wants to merge 13 commits into
base: add/outbox-collection
Choose a base branch
from

Conversation

pfefferle
Copy link
Member

@pfefferle pfefferle commented Jan 20, 2025

Simple dispatcher based on the Outbox-Collection.

This is a simple rewrite of the current dispatcher system, to use the Outbox instead of the Scheduler.

This is a first draft and will be improved over time, to better handle:

  • Re-tries
  • Errors
  • Logging
  • Batch processing

This is a simple rewrite of the current dispatcher system, to use the Outbox instead of the Scheduler.

This is a first draft and will be improved over time, to better handle:

* Re-tries
* Errors
* Logging
* Batch processing
@mattwiebe
Copy link
Contributor

This is a first draft and will be improved over time, to better handle:

  • Re-tries
  • Errors
  • Logging
  • Batch processing

I'm going to take on some or all of those, let's see how far I get.

@mattwiebe
Copy link
Contributor

@pfefferle I assume we need to get these tests passed? I'd really like this merged into #593 before I bring in my error/logging stuff

@mattwiebe mattwiebe mentioned this pull request Jan 21, 2025
1 task
* Initialize the class, registering WordPress hooks.
*/
public static function init() {
\add_action( 'activitypub_process_outbox', array( self::class, 'process_outbox' ), 10, 1 );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
\add_action( 'activitypub_process_outbox', array( self::class, 'process_outbox' ), 10, 1 );
\add_action( 'activitypub_process_outbox', array( self::class, 'process_outbox' ) );

Priority 10 and 1 accepted arg are defaults.

Comment on lines +109 to +110
$outbox_item->post_status = 'publish';
\wp_update_post( $outbox_item );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$outbox_item->post_status = 'publish';
\wp_update_post( $outbox_item );
\wp_publish_post( $outbox_item );

I don't know if one is "better" than the other but I wanted to offer it

@@ -120,8 +120,7 @@ public function get_items( $request ) {
'author' => $user_id > 0 ? $user_id : null,
'paged' => $page,
'post_type' => Outbox::POST_TYPE,
'post_status' => 'draft',

'post_status' => 'any',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'post_status' => 'any',
'post_status' => 'any',

You don't want to keep the new line?

obenland added a commit that referenced this pull request Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants