Skip to content

Commit

Permalink
Add batch size filters.
Browse files Browse the repository at this point in the history
  • Loading branch information
thijsoo committed Nov 3, 2023
1 parent 82f7324 commit 52e6c52
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

/**
* The Verification_Cron_Callback_Integration class.
*
* @phpcs:disable Yoast.NamingConventions.ObjectNameDepth.MaxExceeded
*/
class Verification_No_Timestamp_Cron_Callback_Integration implements Integration_Interface {
Expand Down Expand Up @@ -113,7 +114,12 @@ public function start_verify_non_timestamped_indexables() {
return;
}

$batch_size = 10;
/**
* Filter: 'Yoast\WP\SEO\no_timestamped_indexable_verify_limit_size' - Adds the possibility to limit the number of items that are indexed when in cron action.
*
* @api int $limit Maximum number of indexables to be indexed per indexing action.
*/
$batch_size = \apply_filters( 'Yoast\WP\SEO\no_timestamped_indexable_verify_limit_size', 15 ); //@phpcs:ignore Yoast.NamingConventions.ValidHookName.MaxExceeded -- The name needs to be descriptive since it is a very niche use case
$current_batch = $this->cron_batch_handler->get_current_non_timestamped_indexables_batch();
$action = $this->verification_action_handler->get_current_verification_action();
$command = new Verify_Non_Timestamp_Indexables_Command( $current_batch, $batch_size, $action );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,12 @@ public function start_verify_posts(): void {

return;
}

$batch_size = 10;
/**
* Filter: 'Yoast\WP\SEO\post_verify_indexing_limit_size' - Adds the possibility to limit the number of items that are indexed when in cron action.
*
* @api int $limit Maximum number of indexables to be indexed per indexing action.
*/
$batch_size = \apply_filters( 'Yoast\WP\SEO\post_verify_indexing_limit_size', 15 ); //@phpcs:ignore Yoast.NamingConventions.ValidHookName.MaxExceeded -- The name needs to be descriptive since it is a very niche use case
$last_batch = $this->cron_batch_handler->get_current_post_indexables_batch();

$this->verify_post_indexables_command_handler->handle( new Verify_Post_Indexables_Command( $batch_size, $last_batch ) );
Expand Down

0 comments on commit 52e6c52

Please sign in to comment.