【问题标题】:php GearmanClient timeoutphp GearmanClient 超时
【发布时间】:2011-08-03 09:12:37
【问题描述】:

我在 php 中使用 gearman pecl 扩展,并且希望函数调用超时。 两个用例:(1)没有运行的工人,(2)工人需要太长时间才能完成

如果一切都在运行,调用速度非常快,我想避免这个超时产生开销。

我目前使用的代码:

$client = new GearmanClient();
$client->addServer();
$client->do('nonexistingfunction');

【问题讨论】:

标签: php gearman


【解决方案1】:

只需调用 GearmanClient::setTimeout 方法等待毫秒数:

$client = new GearmanClient();
$client->addServer();
$client->setTimeout(5000);

【讨论】:

  • 我认为这是与 gearman 守护进程的 I/O 通信超时,对我的问题没有帮助。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-03-30
  • 2018-01-12
  • 2011-02-25
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多