Cron_Monitor::check_for_scheduled_crons()

Summary

No summary available.

Return

(void)


Source

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

	public function check_for_scheduled_crons() {
		$next_start = wp_next_scheduled( Cron_Runner::START_CRON );
		if ( ! empty( $next_start ) ) {
			return; // we have a run scheduled, so all is well
		}
		$next_continue = wp_next_scheduled( Cron_Runner::CONTINUE_CRON );
		if ( ! empty( $next_continue ) ) {
			return; // we have a run scheduled, so all is well
		}

		$lock      = new Lock();
		$scheduler = new Cron_Scheduler();

		$status  = new Status();
		$current = $status->current_status();
		if ( $current[ 'status' ] === Status::NOT_STARTED ) {
			$scheduler->schedule_next_import();

			return;
		}

		if ( ! $lock->get_lock() ) {
			$scheduler->schedule_next_batch();

			return;
		}

		// there must be an import running right now
	}


User Contributed Notes

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