GearmanClient::setTimeout

(PECL gearman >= 0.6.0)

GearmanClient::setTimeoutSet socket I/O activity timeout

说明

public bool GearmanClient::setTimeout ( int $timeout )

Sets the timeout for socket I/O activity.

参数

timeout

An interval of time in milliseconds

返回值

Always returns TRUE.

User Contributed Notes

casper at bcx dot nl 31-Aug-2017 05:00
If a timeout is set with this method, and a timeout occurred, calling ->returnCode() will return GEARMAN_TIMEOUT

Beware that a timeout of for example a doBackground() call does not mean the job did not start. It's very possible the job got submitted and started but the gearmand server was not able to communicate that information back to you.
Ismael Cristal Jr 06-Oct-2012 11:54
GearmanClient has a default timeout of -1 you need to set this to a positive number using setTimeout to avoid cases where your script waits forever to run a job even if there are no workers running at all.