PHP Class ResqueScheduler_Worker

Author: Chris Boulton ([email protected])
Show file Open project: chrisboulton/php-resque-scheduler Class Usage Examples

Public Properties

Property Type Description
$logLevel Current log level of this worker.

Protected Properties

Property Type Description
$interval Interval to sleep for between checking schedules.

Public Methods

Method Description
enqueueDelayedItemsForTimestamp ( DateTime | integer $timestamp ) Schedule all of the delayed jobs for a given timestamp.
handleDelayedItems ( DateTime | integer $timestamp = null ) Handle delayed items for the next scheduled timestamp.
log ( string $message ) Output a given log message to STDOUT.
work ( integer $interval = null ) The primary loop for a worker.

Protected Methods

Method Description
sleep ( ) Sleep for the defined interval.

Private Methods

Method Description
updateProcLine ( string $status ) Update the status of the current worker process.

Method Details

enqueueDelayedItemsForTimestamp() public method

Searches for all items for a given timestamp, pulls them off the list of delayed jobs and pushes them across to Resque.
public enqueueDelayedItemsForTimestamp ( DateTime | integer $timestamp )
$timestamp DateTime | integer Search for any items up to this timestamp to schedule.

handleDelayedItems() public method

Searches for any items that are due to be scheduled in Resque and adds them to the appropriate job queue in Resque.
public handleDelayedItems ( DateTime | integer $timestamp = null )
$timestamp DateTime | integer Search for any items up to this timestamp to schedule.

log() public method

Output a given log message to STDOUT.
public log ( string $message )
$message string Message to output.

sleep() protected method

Sleep for the defined interval.
protected sleep ( )

work() public method

Every $interval (seconds), the scheduled queue will be checked for jobs that should be pushed to Resque.
public work ( integer $interval = null )
$interval integer How often to check schedules.

Property Details

$interval protected property

Interval to sleep for between checking schedules.
protected $interval

$logLevel public property

Current log level of this worker.
public $logLevel