fix: set de lock duration BG process

This commit is contained in:
vnmedeiros 2024-05-09 10:15:24 -03:00
parent 1e74183e1f
commit 22d2cd57b3
1 changed files with 2 additions and 1 deletions

View File

@ -274,9 +274,10 @@
$this->debug('locking process: ' . $this->identifier); $this->debug('locking process: ' . $this->identifier);
$this->start_time = time(); // Set start time of current process. $this->start_time = time(); // Set start time of current process.
$max_execution_time = ini_get('max_execution_time'); $max_execution_time = ini_get('max_execution_time');
$lock_duration = ( property_exists( $this, 'queue_lock_time' ) ) ? $this->queue_lock_time : ( empty($max_execution_time) ? 60 : ($max_execution_time * 1.5) ); // 1 minute $lock_duration = ( property_exists( $this, 'queue_lock_time' ) && !empty($this->queue_lock_time) ) ? $this->queue_lock_time : ( empty($max_execution_time) ? 60 : ($max_execution_time * 1.5) ); // 1 minute
$lock_duration = apply_filters( $this->identifier . '_queue_lock_time', $lock_duration ); $lock_duration = apply_filters( $this->identifier . '_queue_lock_time', $lock_duration );
$this->process_lock_in_time = microtime(); $this->process_lock_in_time = microtime();
$this->debug('locking duration: ' . $lock_duration);
if(!$this->is_process_running()) if(!$this->is_process_running())
set_site_transient( $this->identifier . '_process_lock', $this->process_lock_in_time, $lock_duration ); set_site_transient( $this->identifier . '_process_lock', $this->process_lock_in_time, $lock_duration );
} }