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

#75 WP 5.1 Pre-flight filters #91

Merged
merged 55 commits into from
Feb 18, 2020
Merged

#75 WP 5.1 Pre-flight filters #91

merged 55 commits into from
Feb 18, 2020

Conversation

roborourke
Copy link
Contributor

@roborourke roborourke commented Jan 16, 2020

Forked from #84

Fixes #75
Fixes #80

The new filters will require additional hits to the database to determine job IDs. This warms the non-persitent cache with individual jobs to reduce unrequired hits to the databse.
.travis.yml Outdated Show resolved Hide resolved
@rmccue
Copy link
Member

rmccue commented Jan 28, 2020

looking at the cavalcade-jobs group I'm not sure I understand why it's not using a persistent cache?

When it's used and updated in Cavalcade Runner, it doesn't have proper access to the object cache; in particular, we don't know (IIRC) the cache key generation algorithm. Because of this, the cache can't be authoritative.

On my todo list to properly review this!

@roborourke
Copy link
Contributor Author

Thanks for the explanation @rmccue. Seems kinda wild that the cache key generation isn't the same, that's a shame. I hadn't considered the runner environment.

I think to move this forward we leave the cache as non-persistent and the db update in #95 will give us a performance boost in a different way.

@rmccue
Copy link
Member

rmccue commented Jan 29, 2020

Seems kinda wild that the cache key generation isn't the same, that's a shame. I hadn't considered the runner environment.

It's an internal implementation detail of the object cache, but we're not loading the cache at all in the runner, so we don't know how to use the cache (i.e. how does the runner know if you're using memcache or Redis?). We could potentially load it in, but we're then tying the runner heavily into how WP works; also, we're likely to hit memory errors due to the OC's in-memory cache.

inc/class-job.php Show resolved Hide resolved
inc/class-job.php Outdated Show resolved Hide resolved
inc/class-job.php Outdated Show resolved Hide resolved
inc/class-job.php Show resolved Hide resolved
inc/class-job.php Outdated Show resolved Hide resolved
inc/connector/namespace.php Outdated Show resolved Hide resolved
inc/connector/namespace.php Outdated Show resolved Hide resolved
inc/connector/namespace.php Outdated Show resolved Hide resolved
inc/connector/namespace.php Outdated Show resolved Hide resolved
inc/connector/namespace.php Outdated Show resolved Hide resolved
Copy link
Contributor

@peterwilsoncc peterwilsoncc left a comment

Choose a reason for hiding this comment

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

Night shift changes lgtm

Copy link
Contributor

@peterwilsoncc peterwilsoncc left a comment

Choose a reason for hiding this comment

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

We started testing this at work, @ffxluca discovered a back-compat issue.

* }
* @return null|bool True if event successfully scheduled. False for failure.
*/
function pre_schedule_event( $pre, $event ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This will need to fire the schedule_event filter to match Core's existing behaviour allowing events to be changed prior to saving. (Work uses the hook to test cron events are registered properly so our tests started failing.)

Copy link
Contributor

Choose a reason for hiding this comment

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

Added in 2c86202.

Per core, it allows the event to be changed after duplicates have been checked for.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Aha, good catch @peterwilsoncc. I'll check for any other filters we're bypassing too

@roborourke
Copy link
Contributor Author

roborourke commented Feb 17, 2020

@peterwilsoncc @rmccue I also noticed in another place we're respecting any filters that run before ours but with this update we're not checking the value of $pre as passed in. I'm thinking we probably should allow that.

See this branch for what I mean: https://github.com/humanmade/Cavalcade/compare/75-wp51-filters-fork...respect-the-filtery?expand=1

@peterwilsoncc
Copy link
Contributor

@roborourke Yeah, let's. I'm inclined to keep the hooks on 10 but we should allow for other plugins.

Copy link
Member

@rmccue rmccue left a comment

Choose a reason for hiding this comment

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

I think this is good to go.

Let's merge it, and start testing it on live servers.

@roborourke roborourke merged commit 27a3cb4 into master Feb 18, 2020
@roborourke roborourke deleted the 75-wp51-filters-fork branch February 18, 2020 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants