humanmade / Cavalcade

A better wp-cron. Horizontally scalable, works perfectly with multisite.
https://engineering.hmn.md/projects/cavalcade/
Other
519 stars 46 forks source link

Eager bootstrapping of the plugin #105

Closed roborourke closed 4 years ago

roborourke commented 4 years ago

We can't know for sure how the plugin is loaded, eg. as a muplugin or otherwise but we can at least bootstrap it as soon as the file is loaded. This means any plugins such as Jetpack doing odd things on plugins loaded like scheduling events will be using Cavalcade instead of the options table.

Fixes #83 kind of

rmccue commented 4 years ago

Looking at what bootstrap() does:

The site option is the only one that seems maybe a bit 😬; can we at least move the get_option call into the anonymous function? Unless there was a reason that it's not... and this is also only called on single site -> multisite conversion...

roborourke commented 4 years ago

Completely missed that get_option() issue - yeah I'll dig into that a bit more, feels like that should just use get_site_option()

roborourke commented 4 years ago

@rmccue get_option() can safely be moved inside that filter, the function that calls (same name) also calls get_option() a bunch of times and there's no switch_to_blog() calls or anything like that going on.