Skip to content

Conversation

@n7studios
Copy link
Contributor

@n7studios n7studios commented Nov 20, 2024

Summary

Fixes the below reported issues, by ensuring that the Broadcast to Posts WordPress Cron Event exists, should it be deleted by a third party Plugin.

https://app.intercom.com/a/inbox/e4n3xtxz/inbox/shared/all/conversation/12263836210039?view=List
https://app.intercom.com/a/inbox/e4n3xtxz/inbox/shared/all/conversation/12263835305931?view=List
https://app.intercom.com/a/inbox/e4n3xtxz/inbox/shared/all/conversation/12263835371174?view=List
https://app.intercom.com/a/inbox/e4n3xtxz/inbox/shared/all/conversation/12263835396821?view=List

In turn, the 'Import Now' button will be displayed, and Broadcasts will import to WordPress Posts )if the functionality is enabled in the Plugin's settings).

Testing

  • testBroadcastsCronEventRecreatedWhenDeleted: Acceptance test to confirm the Cron event is recreated when deleted.
  • testCronEventRecreatedAfterDeleted: Unit test to confirm Cron event is recreated when deleted.

Checklist

@n7studios n7studios added the bug label Nov 20, 2024
@n7studios n7studios self-assigned this Nov 20, 2024
@n7studios n7studios requested review from a team, corydhmiller and noelherrick and removed request for a team November 20, 2024 11:01
@n7studios n7studios marked this pull request as ready for review November 20, 2024 11:01
Copy link
Contributor

@noelherrick noelherrick left a comment

Choose a reason for hiding this comment

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

Would this have performance effects for slow instances or for ones that get a lot of traffic?

@n7studios
Copy link
Contributor Author

Would this have performance effects for slow instances or for ones that get a lot of traffic?

If the cron event isn't missing, performance is exactly the same compared to the main branch:
main

If the cron event is missing, an additional 2 queries are run one time to restore it:
pr

It won't have a performance effect, as it only schedules the cron event if it's missing. Stack trace to check results in querying a row from the wp_options table, which is already loaded, typically from cache:

get_cron_event()
wp_get_schedule()
wp_get_scheduled_event()
_get_cron_array()
get_option()

@n7studios n7studios merged commit cb4e040 into main Nov 25, 2024
77 checks passed
@n7studios n7studios deleted the reschedule-cron-events branch February 28, 2025 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants