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

Handle ResaveElements job #45

Closed
sjelfull opened this issue Dec 2, 2018 · 4 comments
Closed

Handle ResaveElements job #45

sjelfull opened this issue Dec 2, 2018 · 4 comments
Labels
enhancement New feature or request

Comments

@sjelfull
Copy link

sjelfull commented Dec 2, 2018

When ResaveElements is firing, Blitz is going to listen to that and potentially add lots of jobs for every single elements. If a big section is being resaved, that will be a lot of jobs.

Instead, Blitz should patiently wait until the resave is done, tally up all the elements to work with, then fire off job(s).

In Audit, I listen for a few events to control when a resave start and ends.

In other plugins I have taken this further, and uses the cache to save element references while the resave is going on, then process the elements at the end.

@putyourlightson
Copy link
Collaborator

Thanks for the suggestion. In Audit, I see that you're listening for the Elements::EVENT_AFTER_SAVE_ELEMENT event as well. Are you differentiating between a regular element save and a resave element done in a queue job?

@sjelfull
Copy link
Author

sjelfull commented Dec 3, 2018

Yes, I create a log record when the queue job starts, saves the id of that entry to the cache, and while the resave is going on, any records created will be grouped by that parent entry.

Once the job ends/fails, it removes that parent id and saves a final record.

@putyourlightson
Copy link
Collaborator

Thanks, I'll add this to the list.

@putyourlightson putyourlightson self-assigned this Dec 4, 2018
@putyourlightson putyourlightson added the enhancement New feature or request label Dec 4, 2018
@putyourlightson
Copy link
Collaborator

This has been addressed in 1.10.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant