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

Outbox: Improve batch handling #1286

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

Outbox: Improve batch handling #1286

wants to merge 33 commits into from

Conversation

pfefferle
Copy link
Member

@pfefferle pfefferle commented Feb 7, 2025

After a new item is added to the Outbox, every pending item of the same type will be "invalidated". This way, we ensure that older Updates won't be published if there is already a newer one.

Aside from that, this PR allows us to filter by ID and to better debug by title.

@pfefferle pfefferle added the Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary. label Feb 7, 2025
@pfefferle pfefferle requested a review from obenland February 7, 2025 11:45
@pfefferle pfefferle self-assigned this Feb 7, 2025
Base automatically changed from add/batch-processing to trunk February 7, 2025 12:47
@github-actions github-actions bot added the [Focus] Compatibility Ensuring the plugin plays well with other plugins label Feb 7, 2025
@pfefferle pfefferle changed the title Improve Outbox Data Outbox: Improve batch handling Feb 7, 2025
obenland and others added 20 commits February 7, 2025 15:40
* add some actions

* fix phpdoc

* Use "Unreleased" instead of version number

* Add readme

* Switch actions

props @obenland

* renamed action names

* fix phpdoc

* fix phpdoc

* fix phpdoc

* fix namings

* fix phpcs issues
We'll do that in a separate PR
* Stream: Only surface errors in Outbox processing

Also adds support for comment and user types.

* Add changelog

* fix readme

* update to new batch processing

* fix phpcs

* fix phpcs

* re-use wordings from the rest controllers

* fix phpcs

* restructure the output to match the errors

* revert latest changes

* Fixed changelog

---------

Co-authored-by: Matthias Pfefferle <[email protected]>
Makes it a bit easier to see what's happening when reading the code.
* Outbox Batch: Only pass outbox id to jobs

* Remove unnecessary imports
This allows us to filter by ID and to better debug by title.
@obenland obenland force-pushed the improve/outbox-data branch from f4ab80b to 39a3a1c Compare February 7, 2025 14:49
@pfefferle pfefferle requested a review from a team February 11, 2025 16:49
@obenland
Copy link
Member

We currently don't seem to account for the blog user's reposts
image

@pfefferle
Copy link
Member Author

@obenland what do you mean? all the Announces are the reposts.

@obenland
Copy link
Member

Right, I would have expected those to also be canceled and the Outbox item published

@pfefferle
Copy link
Member Author

Ah, that is what you meant! makes sense!

$meta_query = array(
array(
'key' => '_activitypub_object_id',
'value' => $object_id,
Copy link
Member

Choose a reason for hiding this comment

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

For Blog users, the object_id contains a timestamp (http://localhost:8888/?p=1834#activity-update-2025-02-11T21:02:54Z), so there won't be a shared object_id between activities. Should we remove the hash for this purpose?

Copy link
Member Author

Choose a reason for hiding this comment

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

we should either use the guid of the original Outbox-Item or the get_id of the original $wp_object.

Copy link
Member

Choose a reason for hiding this comment

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

I like the original $wp_object, which it already saves currently, just with the added hash. we could strip the hash in Outbox::add()

Copy link
Member Author

Choose a reason for hiding this comment

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

This feels hacky! the hash was a workaround because we had no persistant IDs. I would like to fix that, so that we do no longer have the hashes anywhere.

Copy link
Member

Choose a reason for hiding this comment

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

Sure! Could I leave that with you? I still don't feel super confident in that area

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Collections [Focus] Compatibility Ensuring the plugin plays well with other plugins Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants