Skip to content

Fail Job After N Seconds #187

@bmeynell

Description

@bmeynell

When running several jobs in parallel similar to this, the worker should be able to define a job-level timeout, and when that time is exceeded, mark the job as failed. This is important for all blocking (foreground) jobs as the client is perpetually stalled until the slowest running job is completed.

Gearman Protocol:

Worker Requests
...
CAN_DO_TIMEOUT

Same as CAN_DO, but with a timeout value on how long the job
is allowed to run. After the timeout value, the job server will
mark the job as failed and notify any listening clients.

Arguments:

  • NULL byte terminated Function name.
  • Timeout value.

GearmanWorker::register ( string $function_name [, int $timeout ] ):

Registers a function name with the job server with an optional timeout. The timeout specifies how many seconds the server will wait before marking a job as failed. If the timeout is set to zero, there is no timeout.

GearmanWorker::addFunction ( string $function_name , callable $function [, mixed &$context [, int $timeout ]] ):

Registers a function name with the job server and specifies a callback corresponding to that function. Optionally specify ... a timeout.

Is there a way to achieve this functionality with this bundle?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions