site-kit-wp icon indicating copy to clipboard operation
site-kit-wp copied to clipboard

Phase out Cron API

Open aaemnnosttv opened this issue 7 years ago • 8 comments

Bug Description

The \Google\Site_Kit\Core\Util\Cron class is a relic of an earlier implementation of the plugin and no longer serves a useful purpose. Currently the only module which is using it is the PageSpeed Insights module. Functionally, the cron that runs is not providing any benefit since the data that is fetched in the background is not cached.

This class and its use is to be phased out and removed, per @felixarntz .


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • Ensure no fatal error occurs during basic plugin usage and particularly during setup and usage of the PSI module.

Implementation Brief

  • Delete \Google\Site_Kit\Core\Util\Cron
  • Remove usage of filters provided from modules
    • googlesitekit_cron_daily_requests
    • googlesitekit_cron_hourly_requests
  • Register actions in Plugin for site kit cron hooks that unschedule the event (avoids the need to check for if scheduled on every request)
    • googlesitekit_cron_daily
    • googlesitekit_cron_hourly
  • Register action on googlesitekit_deactivation in Plugin to ensure cron events are unscheduled if deactivated before event runs
  • Note added actions for cleanup are to be removed in a future release
  • Update tests accordingly
    • No Cron test to delete
    • Update PluginTest to test added hooks

Changelog entry

  • N/A

aaemnnosttv avatar Jul 09 '19 17:07 aaemnnosttv

Assigning to @aaemnnosttv to write the implementation brief. Many thanks!

lilybonney avatar Jul 10 '19 11:07 lilybonney

Ready for brief review.

aaemnnosttv avatar Jul 10 '19 11:07 aaemnnosttv

@aaemnnosttv Since we are in developer beta, I'd say it's okay if we remove the class right away (although I like your BC approach in general). We could probably make the call to remove old scheduled hooks manually in the Plugin main class and not rely on the Cron class (leaves us only with little legacy overhead). Let me know if you think that's feasible.

felixarntz avatar Jul 11 '19 16:07 felixarntz

Either way we have code to be removed later but I think your suggestion sounds a bit cleaner with more we can remove now and less to remove later 👍

Updating the brief now.

aaemnnosttv avatar Jul 11 '19 16:07 aaemnnosttv

@felixarntz I've updated the brief, so this is ready for your review again.

aaemnnosttv avatar Jul 11 '19 17:07 aaemnnosttv

@aaemnnosttv Implementation brief looks good. I just merged the Plugin tests, so those can be updated as part of this as well now.

felixarntz avatar Jul 12 '19 10:07 felixarntz

Great, I just updated the IB to note that PluginTest will be updated 👍

aaemnnosttv avatar Jul 12 '19 15:07 aaemnnosttv

QA looking good!

felixarntz avatar Jul 16 '19 16:07 felixarntz