Automattic\WooCommerce\Internal\BatchProcessing
BatchProcessingController::release_enqueued_processors_lock
Release the enqueued-processors lock by deleting the options-table row we own.
The delete is conditional on the stored release time still matching the one written when the lock was acquired, so a lock that expired and was taken over by another request is never released out from under it.
Method of the class: BatchProcessingController{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->release_enqueued_processors_lock( $expiry ): void;
- $expiry(string) (required)
- The release time returned by acquire_enqueued_processors_lock().
Changelog
| Since 11.0.0 | Introduced. |
BatchProcessingController::release_enqueued_processors_lock() BatchProcessingController::release enqueued processors lock code WC 11.0.1
private function release_enqueued_processors_lock( string $expiry ): void {
global $wpdb;
$suppress = $wpdb->suppress_errors( true );
try {
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
$wpdb->delete(
$wpdb->options,
array(
'option_name' => self::ENQUEUED_PROCESSORS_LOCK_OPTION,
'option_value' => $expiry,
),
array( '%s', '%s' )
);
} finally {
$wpdb->suppress_errors( $suppress );
}
}