-
Notifications
You must be signed in to change notification settings - Fork 80
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
Race conditions e.g. on post creation: Post not "ready" when added to outbox. #1269
Comments
\Activitypub\add_to_outbox
\Activitypub\add_to_outbox
to make sure objects are ready.
\Activitypub\add_to_outbox
to make sure objects are ready.
We had to add a callback to make post meta available earlier for posts that get saved through the Rest API. Is that what you're running into here? Or is it something else? |
@obenland This could indeed by the same problem. But maybe there are further issues, e.g. when on the request where a post is created also other related posts or terms are created (venue post/term of an event post that is created on the fly). |
For related posts, my assumption would be that they get added to the outbox through existing hooks. Is terms support something you're working on? Would a callback like the one we used help in that case? |
Not all post types are also scheduled. But lets take the "The Events Calendar" plugin as an example, it is easier to understand that way and that plugin is highly popular:
However, regarding "The Events Calendar" the problem could be reduced to the post_meta race condition because it seems that Other example: Some other event plugins use a custom term for the venues/organizers. I had no time yet to check if there are more race conditions. Next steps? |
Agreed, in general :) Could you try that |
While I understand the issue and that this is a quite straight forward fix, it feels wild to have a schedule to add it to a schedule 🫣 It's getting quite complex now! |
@pfefferle And do not forget that batch processing that will follow! Another schedule of the schedule of the schedule. 🫠 Complexity... hmm. Depends on whether there is another less complex option. I feel like having lots of filter and hooks are also not non-complex :)
@obenland I will do so now. |
I don't know. If we were to remove the Now if that's a good idea or not… 🤷 |
But in the case of @Menrath it is not necessarily the meta, but the missing taxonomies! |
@obenland I cannot test this without a lot of effort generically. But I ran some manual tests: Using the normal |
Quick summary
Sometimes there is a race condition:
add_to_outbox
gets called immediatelyadd_to_outbox
the transformer gets called directly: sometimes even before the object that should get transformed is fully ready (e.g. post-meta is not set yet)Steps to reproduce
Use the plugin "The Events Calendar". Create a new event post with a venue. The post scheduler gets called which calls
add_to_outbox
. At this stage the venue is not yet linked to the event post:\tribe_has_venue( $post_id )
returns false. As are most or all other meta values.If a workaround is available, please outline it here.
Use scheduling within the
add_to_outbox
function.The text was updated successfully, but these errors were encountered: