734 lines
16 KiB
YAML
734 lines
16 KiB
YAML
name: Worker
|
|
class_comment: null
|
|
dependencies:
|
|
- name: CacheContract
|
|
type: class
|
|
source: Illuminate\Contracts\Cache\Repository
|
|
- name: ExceptionHandler
|
|
type: class
|
|
source: Illuminate\Contracts\Debug\ExceptionHandler
|
|
- name: Dispatcher
|
|
type: class
|
|
source: Illuminate\Contracts\Events\Dispatcher
|
|
- name: QueueManager
|
|
type: class
|
|
source: Illuminate\Contracts\Queue\Factory
|
|
- name: DetectsLostConnections
|
|
type: class
|
|
source: Illuminate\Database\DetectsLostConnections
|
|
- name: JobExceptionOccurred
|
|
type: class
|
|
source: Illuminate\Queue\Events\JobExceptionOccurred
|
|
- name: JobPopped
|
|
type: class
|
|
source: Illuminate\Queue\Events\JobPopped
|
|
- name: JobPopping
|
|
type: class
|
|
source: Illuminate\Queue\Events\JobPopping
|
|
- name: JobProcessed
|
|
type: class
|
|
source: Illuminate\Queue\Events\JobProcessed
|
|
- name: JobProcessing
|
|
type: class
|
|
source: Illuminate\Queue\Events\JobProcessing
|
|
- name: JobReleasedAfterException
|
|
type: class
|
|
source: Illuminate\Queue\Events\JobReleasedAfterException
|
|
- name: JobTimedOut
|
|
type: class
|
|
source: Illuminate\Queue\Events\JobTimedOut
|
|
- name: Looping
|
|
type: class
|
|
source: Illuminate\Queue\Events\Looping
|
|
- name: WorkerStopping
|
|
type: class
|
|
source: Illuminate\Queue\Events\WorkerStopping
|
|
- name: Carbon
|
|
type: class
|
|
source: Illuminate\Support\Carbon
|
|
- name: Throwable
|
|
type: class
|
|
source: Throwable
|
|
- name: DetectsLostConnections
|
|
type: class
|
|
source: DetectsLostConnections
|
|
properties:
|
|
- name: name
|
|
visibility: protected
|
|
comment: '# * The name of the worker.
|
|
|
|
# *
|
|
|
|
# * @var string'
|
|
- name: manager
|
|
visibility: protected
|
|
comment: '# * The queue manager instance.
|
|
|
|
# *
|
|
|
|
# * @var \Illuminate\Contracts\Queue\Factory'
|
|
- name: events
|
|
visibility: protected
|
|
comment: '# * The event dispatcher instance.
|
|
|
|
# *
|
|
|
|
# * @var \Illuminate\Contracts\Events\Dispatcher'
|
|
- name: cache
|
|
visibility: protected
|
|
comment: '# * The cache repository implementation.
|
|
|
|
# *
|
|
|
|
# * @var \Illuminate\Contracts\Cache\Repository'
|
|
- name: exceptions
|
|
visibility: protected
|
|
comment: '# * The exception handler instance.
|
|
|
|
# *
|
|
|
|
# * @var \Illuminate\Contracts\Debug\ExceptionHandler'
|
|
- name: isDownForMaintenance
|
|
visibility: protected
|
|
comment: '# * The callback used to determine if the application is in maintenance
|
|
mode.
|
|
|
|
# *
|
|
|
|
# * @var callable'
|
|
- name: resetScope
|
|
visibility: protected
|
|
comment: '# * The callback used to reset the application''s scope.
|
|
|
|
# *
|
|
|
|
# * @var callable'
|
|
- name: shouldQuit
|
|
visibility: public
|
|
comment: '# * Indicates if the worker should exit.
|
|
|
|
# *
|
|
|
|
# * @var bool'
|
|
- name: paused
|
|
visibility: public
|
|
comment: '# * Indicates if the worker is paused.
|
|
|
|
# *
|
|
|
|
# * @var bool'
|
|
- name: popCallbacks
|
|
visibility: protected
|
|
comment: '# * The callbacks used to pop jobs from queues.
|
|
|
|
# *
|
|
|
|
# * @var callable[]'
|
|
methods:
|
|
- name: __construct
|
|
visibility: public
|
|
parameters:
|
|
- name: manager
|
|
- name: events
|
|
- name: exceptions
|
|
- name: isDownForMaintenance
|
|
- name: resetScope
|
|
default: 'null'
|
|
comment: "# * The name of the worker.\n# *\n# * @var string\n# */\n# protected $name;\n\
|
|
# \n# /**\n# * The queue manager instance.\n# *\n# * @var \\Illuminate\\Contracts\\\
|
|
Queue\\Factory\n# */\n# protected $manager;\n# \n# /**\n# * The event dispatcher\
|
|
\ instance.\n# *\n# * @var \\Illuminate\\Contracts\\Events\\Dispatcher\n# */\n\
|
|
# protected $events;\n# \n# /**\n# * The cache repository implementation.\n# *\n\
|
|
# * @var \\Illuminate\\Contracts\\Cache\\Repository\n# */\n# protected $cache;\n\
|
|
# \n# /**\n# * The exception handler instance.\n# *\n# * @var \\Illuminate\\Contracts\\\
|
|
Debug\\ExceptionHandler\n# */\n# protected $exceptions;\n# \n# /**\n# * The callback\
|
|
\ used to determine if the application is in maintenance mode.\n# *\n# * @var\
|
|
\ callable\n# */\n# protected $isDownForMaintenance;\n# \n# /**\n# * The callback\
|
|
\ used to reset the application's scope.\n# *\n# * @var callable\n# */\n# protected\
|
|
\ $resetScope;\n# \n# /**\n# * Indicates if the worker should exit.\n# *\n# *\
|
|
\ @var bool\n# */\n# public $shouldQuit = false;\n# \n# /**\n# * Indicates if\
|
|
\ the worker is paused.\n# *\n# * @var bool\n# */\n# public $paused = false;\n\
|
|
# \n# /**\n# * The callbacks used to pop jobs from queues.\n# *\n# * @var callable[]\n\
|
|
# */\n# protected static $popCallbacks = [];\n# \n# /**\n# * Create a new queue\
|
|
\ worker.\n# *\n# * @param \\Illuminate\\Contracts\\Queue\\Factory $manager\n\
|
|
# * @param \\Illuminate\\Contracts\\Events\\Dispatcher $events\n# * @param \
|
|
\ \\Illuminate\\Contracts\\Debug\\ExceptionHandler $exceptions\n# * @param callable\
|
|
\ $isDownForMaintenance\n# * @param callable|null $resetScope\n# * @return\
|
|
\ void"
|
|
- name: daemon
|
|
visibility: public
|
|
parameters:
|
|
- name: connectionName
|
|
- name: queue
|
|
- name: options
|
|
comment: '# * Listen to the given queue in a loop.
|
|
|
|
# *
|
|
|
|
# * @param string $connectionName
|
|
|
|
# * @param string $queue
|
|
|
|
# * @param \Illuminate\Queue\WorkerOptions $options
|
|
|
|
# * @return int'
|
|
- name: registerTimeoutHandler
|
|
visibility: protected
|
|
parameters:
|
|
- name: job
|
|
- name: options
|
|
comment: '# * Register the worker timeout handler.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Queue\Job|null $job
|
|
|
|
# * @param \Illuminate\Queue\WorkerOptions $options
|
|
|
|
# * @return void'
|
|
- name: resetTimeoutHandler
|
|
visibility: protected
|
|
parameters: []
|
|
comment: '# * Reset the worker timeout handler.
|
|
|
|
# *
|
|
|
|
# * @return void'
|
|
- name: timeoutForJob
|
|
visibility: protected
|
|
parameters:
|
|
- name: job
|
|
- name: options
|
|
comment: '# * Get the appropriate timeout for the given job.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Queue\Job|null $job
|
|
|
|
# * @param \Illuminate\Queue\WorkerOptions $options
|
|
|
|
# * @return int'
|
|
- name: daemonShouldRun
|
|
visibility: protected
|
|
parameters:
|
|
- name: options
|
|
- name: connectionName
|
|
- name: queue
|
|
comment: '# * Determine if the daemon should process on this iteration.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Queue\WorkerOptions $options
|
|
|
|
# * @param string $connectionName
|
|
|
|
# * @param string $queue
|
|
|
|
# * @return bool'
|
|
- name: pauseWorker
|
|
visibility: protected
|
|
parameters:
|
|
- name: options
|
|
- name: lastRestart
|
|
comment: '# * Pause the worker for the current loop.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Queue\WorkerOptions $options
|
|
|
|
# * @param int $lastRestart
|
|
|
|
# * @return int|null'
|
|
- name: stopIfNecessary
|
|
visibility: protected
|
|
parameters:
|
|
- name: options
|
|
- name: lastRestart
|
|
- name: startTime
|
|
default: '0'
|
|
- name: jobsProcessed
|
|
default: '0'
|
|
- name: job
|
|
default: 'null'
|
|
comment: '# * Determine the exit code to stop the process if necessary.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Queue\WorkerOptions $options
|
|
|
|
# * @param int $lastRestart
|
|
|
|
# * @param int $startTime
|
|
|
|
# * @param int $jobsProcessed
|
|
|
|
# * @param mixed $job
|
|
|
|
# * @return int|null'
|
|
- name: runNextJob
|
|
visibility: public
|
|
parameters:
|
|
- name: connectionName
|
|
- name: queue
|
|
- name: options
|
|
comment: '# * Process the next job on the queue.
|
|
|
|
# *
|
|
|
|
# * @param string $connectionName
|
|
|
|
# * @param string $queue
|
|
|
|
# * @param \Illuminate\Queue\WorkerOptions $options
|
|
|
|
# * @return void'
|
|
- name: getNextJob
|
|
visibility: protected
|
|
parameters:
|
|
- name: connection
|
|
- name: queue
|
|
comment: '# * Get the next job from the queue connection.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Queue\Queue $connection
|
|
|
|
# * @param string $queue
|
|
|
|
# * @return \Illuminate\Contracts\Queue\Job|null'
|
|
- name: runJob
|
|
visibility: protected
|
|
parameters:
|
|
- name: job
|
|
- name: connectionName
|
|
- name: options
|
|
comment: '# * Process the given job.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Queue\Job $job
|
|
|
|
# * @param string $connectionName
|
|
|
|
# * @param \Illuminate\Queue\WorkerOptions $options
|
|
|
|
# * @return void'
|
|
- name: stopWorkerIfLostConnection
|
|
visibility: protected
|
|
parameters:
|
|
- name: e
|
|
comment: '# * Stop the worker if we have lost connection to a database.
|
|
|
|
# *
|
|
|
|
# * @param \Throwable $e
|
|
|
|
# * @return void'
|
|
- name: process
|
|
visibility: public
|
|
parameters:
|
|
- name: connectionName
|
|
- name: job
|
|
- name: options
|
|
comment: '# * Process the given job from the queue.
|
|
|
|
# *
|
|
|
|
# * @param string $connectionName
|
|
|
|
# * @param \Illuminate\Contracts\Queue\Job $job
|
|
|
|
# * @param \Illuminate\Queue\WorkerOptions $options
|
|
|
|
# * @return void
|
|
|
|
# *
|
|
|
|
# * @throws \Throwable'
|
|
- name: handleJobException
|
|
visibility: protected
|
|
parameters:
|
|
- name: connectionName
|
|
- name: job
|
|
- name: options
|
|
- name: e
|
|
comment: '# * Handle an exception that occurred while the job was running.
|
|
|
|
# *
|
|
|
|
# * @param string $connectionName
|
|
|
|
# * @param \Illuminate\Contracts\Queue\Job $job
|
|
|
|
# * @param \Illuminate\Queue\WorkerOptions $options
|
|
|
|
# * @param \Throwable $e
|
|
|
|
# * @return void
|
|
|
|
# *
|
|
|
|
# * @throws \Throwable'
|
|
- name: markJobAsFailedIfAlreadyExceedsMaxAttempts
|
|
visibility: protected
|
|
parameters:
|
|
- name: connectionName
|
|
- name: job
|
|
- name: maxTries
|
|
comment: '# * Mark the given job as failed if it has exceeded the maximum allowed
|
|
attempts.
|
|
|
|
# *
|
|
|
|
# * This will likely be because the job previously exceeded a timeout.
|
|
|
|
# *
|
|
|
|
# * @param string $connectionName
|
|
|
|
# * @param \Illuminate\Contracts\Queue\Job $job
|
|
|
|
# * @param int $maxTries
|
|
|
|
# * @return void
|
|
|
|
# *
|
|
|
|
# * @throws \Throwable'
|
|
- name: markJobAsFailedIfWillExceedMaxAttempts
|
|
visibility: protected
|
|
parameters:
|
|
- name: connectionName
|
|
- name: job
|
|
- name: maxTries
|
|
- name: e
|
|
comment: '# * Mark the given job as failed if it has exceeded the maximum allowed
|
|
attempts.
|
|
|
|
# *
|
|
|
|
# * @param string $connectionName
|
|
|
|
# * @param \Illuminate\Contracts\Queue\Job $job
|
|
|
|
# * @param int $maxTries
|
|
|
|
# * @param \Throwable $e
|
|
|
|
# * @return void'
|
|
- name: markJobAsFailedIfWillExceedMaxExceptions
|
|
visibility: protected
|
|
parameters:
|
|
- name: connectionName
|
|
- name: job
|
|
- name: e
|
|
comment: '# * Mark the given job as failed if it has exceeded the maximum allowed
|
|
attempts.
|
|
|
|
# *
|
|
|
|
# * @param string $connectionName
|
|
|
|
# * @param \Illuminate\Contracts\Queue\Job $job
|
|
|
|
# * @param \Throwable $e
|
|
|
|
# * @return void'
|
|
- name: markJobAsFailedIfItShouldFailOnTimeout
|
|
visibility: protected
|
|
parameters:
|
|
- name: connectionName
|
|
- name: job
|
|
- name: e
|
|
comment: '# * Mark the given job as failed if it should fail on timeouts.
|
|
|
|
# *
|
|
|
|
# * @param string $connectionName
|
|
|
|
# * @param \Illuminate\Contracts\Queue\Job $job
|
|
|
|
# * @param \Throwable $e
|
|
|
|
# * @return void'
|
|
- name: failJob
|
|
visibility: protected
|
|
parameters:
|
|
- name: job
|
|
- name: e
|
|
comment: '# * Mark the given job as failed and raise the relevant event.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Queue\Job $job
|
|
|
|
# * @param \Throwable $e
|
|
|
|
# * @return void'
|
|
- name: calculateBackoff
|
|
visibility: protected
|
|
parameters:
|
|
- name: job
|
|
- name: options
|
|
comment: '# * Calculate the backoff for the given job.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Queue\Job $job
|
|
|
|
# * @param \Illuminate\Queue\WorkerOptions $options
|
|
|
|
# * @return int'
|
|
- name: raiseBeforeJobPopEvent
|
|
visibility: protected
|
|
parameters:
|
|
- name: connectionName
|
|
comment: '# * Raise the before job has been popped.
|
|
|
|
# *
|
|
|
|
# * @param string $connectionName
|
|
|
|
# * @return void'
|
|
- name: raiseAfterJobPopEvent
|
|
visibility: protected
|
|
parameters:
|
|
- name: connectionName
|
|
- name: job
|
|
comment: '# * Raise the after job has been popped.
|
|
|
|
# *
|
|
|
|
# * @param string $connectionName
|
|
|
|
# * @param \Illuminate\Contracts\Queue\Job|null $job
|
|
|
|
# * @return void'
|
|
- name: raiseBeforeJobEvent
|
|
visibility: protected
|
|
parameters:
|
|
- name: connectionName
|
|
- name: job
|
|
comment: '# * Raise the before queue job event.
|
|
|
|
# *
|
|
|
|
# * @param string $connectionName
|
|
|
|
# * @param \Illuminate\Contracts\Queue\Job $job
|
|
|
|
# * @return void'
|
|
- name: raiseAfterJobEvent
|
|
visibility: protected
|
|
parameters:
|
|
- name: connectionName
|
|
- name: job
|
|
comment: '# * Raise the after queue job event.
|
|
|
|
# *
|
|
|
|
# * @param string $connectionName
|
|
|
|
# * @param \Illuminate\Contracts\Queue\Job $job
|
|
|
|
# * @return void'
|
|
- name: raiseExceptionOccurredJobEvent
|
|
visibility: protected
|
|
parameters:
|
|
- name: connectionName
|
|
- name: job
|
|
- name: e
|
|
comment: '# * Raise the exception occurred queue job event.
|
|
|
|
# *
|
|
|
|
# * @param string $connectionName
|
|
|
|
# * @param \Illuminate\Contracts\Queue\Job $job
|
|
|
|
# * @param \Throwable $e
|
|
|
|
# * @return void'
|
|
- name: queueShouldRestart
|
|
visibility: protected
|
|
parameters:
|
|
- name: lastRestart
|
|
comment: '# * Determine if the queue worker should restart.
|
|
|
|
# *
|
|
|
|
# * @param int|null $lastRestart
|
|
|
|
# * @return bool'
|
|
- name: getTimestampOfLastQueueRestart
|
|
visibility: protected
|
|
parameters: []
|
|
comment: '# * Get the last queue restart timestamp, or null.
|
|
|
|
# *
|
|
|
|
# * @return int|null'
|
|
- name: listenForSignals
|
|
visibility: protected
|
|
parameters: []
|
|
comment: '# * Enable async signals for the process.
|
|
|
|
# *
|
|
|
|
# * @return void'
|
|
- name: supportsAsyncSignals
|
|
visibility: protected
|
|
parameters: []
|
|
comment: '# * Determine if "async" signals are supported.
|
|
|
|
# *
|
|
|
|
# * @return bool'
|
|
- name: memoryExceeded
|
|
visibility: public
|
|
parameters:
|
|
- name: memoryLimit
|
|
comment: '# * Determine if the memory limit has been exceeded.
|
|
|
|
# *
|
|
|
|
# * @param int $memoryLimit
|
|
|
|
# * @return bool'
|
|
- name: stop
|
|
visibility: public
|
|
parameters:
|
|
- name: status
|
|
default: '0'
|
|
- name: options
|
|
default: 'null'
|
|
comment: '# * Stop listening and bail out of the script.
|
|
|
|
# *
|
|
|
|
# * @param int $status
|
|
|
|
# * @param WorkerOptions|null $options
|
|
|
|
# * @return int'
|
|
- name: kill
|
|
visibility: public
|
|
parameters:
|
|
- name: status
|
|
default: '0'
|
|
- name: options
|
|
default: 'null'
|
|
comment: '# * Kill the process.
|
|
|
|
# *
|
|
|
|
# * @param int $status
|
|
|
|
# * @param \Illuminate\Queue\WorkerOptions|null $options
|
|
|
|
# * @return never'
|
|
- name: maxAttemptsExceededException
|
|
visibility: protected
|
|
parameters:
|
|
- name: job
|
|
comment: '# * Create an instance of MaxAttemptsExceededException.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Queue\Job $job
|
|
|
|
# * @return \Illuminate\Queue\MaxAttemptsExceededException'
|
|
- name: timeoutExceededException
|
|
visibility: protected
|
|
parameters:
|
|
- name: job
|
|
comment: '# * Create an instance of TimeoutExceededException.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Queue\Job $job
|
|
|
|
# * @return \Illuminate\Queue\TimeoutExceededException'
|
|
- name: sleep
|
|
visibility: public
|
|
parameters:
|
|
- name: seconds
|
|
comment: '# * Sleep the script for a given number of seconds.
|
|
|
|
# *
|
|
|
|
# * @param int|float $seconds
|
|
|
|
# * @return void'
|
|
- name: setCache
|
|
visibility: public
|
|
parameters:
|
|
- name: cache
|
|
comment: '# * Set the cache repository implementation.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Cache\Repository $cache
|
|
|
|
# * @return $this'
|
|
- name: setName
|
|
visibility: public
|
|
parameters:
|
|
- name: name
|
|
comment: '# * Set the name of the worker.
|
|
|
|
# *
|
|
|
|
# * @param string $name
|
|
|
|
# * @return $this'
|
|
- name: popUsing
|
|
visibility: public
|
|
parameters:
|
|
- name: workerName
|
|
- name: callback
|
|
comment: '# * Register a callback to be executed to pick jobs.
|
|
|
|
# *
|
|
|
|
# * @param string $workerName
|
|
|
|
# * @param callable $callback
|
|
|
|
# * @return void'
|
|
- name: getManager
|
|
visibility: public
|
|
parameters: []
|
|
comment: '# * Get the queue manager instance.
|
|
|
|
# *
|
|
|
|
# * @return \Illuminate\Contracts\Queue\Factory'
|
|
- name: setManager
|
|
visibility: public
|
|
parameters:
|
|
- name: manager
|
|
comment: '# * Set the queue manager instance.
|
|
|
|
# *
|
|
|
|
# * @param \Illuminate\Contracts\Queue\Factory $manager
|
|
|
|
# * @return void'
|
|
traits:
|
|
- Illuminate\Contracts\Debug\ExceptionHandler
|
|
- Illuminate\Contracts\Events\Dispatcher
|
|
- Illuminate\Database\DetectsLostConnections
|
|
- Illuminate\Queue\Events\JobExceptionOccurred
|
|
- Illuminate\Queue\Events\JobPopped
|
|
- Illuminate\Queue\Events\JobPopping
|
|
- Illuminate\Queue\Events\JobProcessed
|
|
- Illuminate\Queue\Events\JobProcessing
|
|
- Illuminate\Queue\Events\JobReleasedAfterException
|
|
- Illuminate\Queue\Events\JobTimedOut
|
|
- Illuminate\Queue\Events\Looping
|
|
- Illuminate\Queue\Events\WorkerStopping
|
|
- Illuminate\Support\Carbon
|
|
- Throwable
|
|
- DetectsLostConnections
|
|
interfaces: []
|