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

Clean our RUCSS action scheduler jobs periodically without affecting others #4945

Merged
merged 4 commits into from
Apr 21, 2022

Conversation

engahmeds3ed
Copy link
Contributor

@engahmeds3ed engahmeds3ed commented Apr 19, 2022

Description

We needed a way to clean our RUCSS action scheduler jobs after 1 hour without affecting the other jobs from other plugins.
Also added a new filter rocket_action_scheduler_retention_period so we can manage the clean lifespan for ours only.

Fixes #4940

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (non-breaking change which improves an existing functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Checklist:

Please delete the options that are not relevant.

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@engahmeds3ed engahmeds3ed marked this pull request as ready for review April 20, 2022 14:43
Copy link
Contributor

@Mai-Saad Mai-Saad left a comment

Choose a reason for hiding this comment

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

Working as expected
testrail-report-375.pdf

@engahmeds3ed engahmeds3ed changed the base branch from develop to release/3.11.0.5 April 20, 2022 21:59
@engahmeds3ed
Copy link
Contributor Author

We also added a new filter here to change the cleaner batch size (default value now is 100)

/**
* Filters the clean batch size.
*
* @since 3.11.0.5
*
* @param int $batch_size Batch size.
*
* @return int
*/
$batch_size = (int) apply_filters( 'rocket_action_scheduler_clean_batch_size', 100, $this->group );

so with each CRON run (every minute), 100 log items will be cleaned.

@engahmeds3ed engahmeds3ed merged commit 1d35d6a into release/3.11.0.5 Apr 21, 2022
@engahmeds3ed engahmeds3ed deleted the enhancement/AS_cleaner branch April 21, 2022 11:24
@jamiematrix
Copy link

jamiematrix commented Sep 1, 2022

We're on v3.11.3 and the rocket_rucss_pending_jobs_cron hook is flooding the actions table. I've checked the source and can see the fix above is in there but it's clearly not working.
Tried to remove the rows from the WPAdmin UI but I'm not able to delete even one job.

Looking through the UI in WordPress it currently lists 10 rows per page, each of those 10 rows appear to be created at the same time. This would suggest there are more than 10 jobs being created each minute so I would assume over time cleaning 100 jobs per minute wouldn't be enough?

@engahmeds3ed
Copy link
Contributor Author

We're on v3.11.3 and the rocket_rucss_pending_jobs_cron hook is flooding the actions table. I've checked the source and can see the fix above is in there but it's clearly not working. Tried to remove the rows from the WPAdmin UI but I'm not able to delete even one job.

Looking through the UI in WordPress it currently lists 10 rows per page, each of those 10 rows appear to be created at the same time. This would suggest there are more than 10 jobs being created each minute so I would assume over time cleaning 100 jobs per minute wouldn't be enough?

Can you plz reach WP Rocket support at support[at]wp-rocket.me they have tools to easily remove all logs at once.

@jamiematrix
Copy link

We're on v3.11.3 and the rocket_rucss_pending_jobs_cron hook is flooding the actions table. I've checked the source and can see the fix above is in there but it's clearly not working. Tried to remove the rows from the WPAdmin UI but I'm not able to delete even one job.
Looking through the UI in WordPress it currently lists 10 rows per page, each of those 10 rows appear to be created at the same time. This would suggest there are more than 10 jobs being created each minute so I would assume over time cleaning 100 jobs per minute wouldn't be enough?

Can you plz reach WP Rocket support at support[at]wp-rocket.me they have tools to easily remove all logs at once.

Will do. Just worked out there have been 19,000+ rows added in the last 15 minutes

@jamiematrix
Copy link

No reply as of yet.
I changed the number of log items to be cleaned to 2000 and it appears to have made no difference. Possibly made it worse

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

Successfully merging this pull request may close these issues.

rocket_rucss_pending_jobs_cron flooding actionscheduler_actions
3 participants