Lock_Monitor::check_for_expired_lock()

Summary

No summary available.

Return

(void)


Source

File: src/BigCommerce/Import/Runner/Lock_Monitor.php

	public function check_for_expired_lock() {
		$lock = new Lock();
		if ( ! $lock->get_lock() ) {
			return; // no lock in place, all is well
		}

		$status  = new Status();
		$current = $status->current_status();
		if ( $current[ 'status' ] === Status::NOT_STARTED ) {
			$lock->release_lock(); // there shouldn't be a lock if no import is in progress

			return;
		}

		if ( $current[ 'timestamp' ] < time() - $this->timeout ) {
			do_action( 'bigcommerce/log', Error_Log::INFO, __( 'Releasing expired import lock', 'bigcommerce' ), [
				'status' => $current,
			] );
			$lock->release_lock(); // the lock is expired

			return;
		}

	}


User Contributed Notes

You must log in before being able to contribute a note or feedback.