wp-media / wp-rocket

Performance optimization plugin for WordPress
https://wp-rocket.me
GNU General Public License v2.0
690 stars 216 forks source link

Preload batch size is artificially reduced as we count in-progress rows with a pending AS action twice #6473

Open MathieuLamiot opened 7 months ago

MathieuLamiot commented 7 months ago

Context I identified the issue when rewriting integration tests for https://github.com/wp-media/wp-rocket/issues/6396 When deciding on the preload batch size, two limitations are implemented:

Expected behavior The effective maximum batch size must be rocket_preload_cache_pending_jobs_cron_rows_count - number of pending actions in the AS queue - in_progress rows that don't have a pending actions in the AS queue.

Acceptance Criteria Test case InProgressShouldNotExceedMaxQueue must be re-written exactly as follows and passing:

piotrbak commented 3 months ago

@MathieuLamiot This is only about the tests, right?

MathieuLamiot commented 3 months ago

No it's actually impacting the way we do preload. It is still valid and will be even after #6396. The impact is that preload can be slower than expected as we count twice an in-progress preload in the batch size. So if you start a new batch (expected: 45 items) but there are already 6 in-progress, I think we only add 33 new items instead of 39.