【发布时间】:2015-10-27 12:49:11
【问题描述】:
我使用 Beanstalkd(带有 - https://github.com/udokmeci/yii2-beanstalk)作为队列。但我需要为下次重试设置自定义延迟,
第一 - 没有延迟 第 2 - 一个小时内 第 3 - 24 小时内
是否可以用 Beanstalkd 来实现?
public function actionCron($job)
{
$sentData = $job->getData();
try {
// I need to setup custom delay there
// 1 hour after 1st retry
// 24 hrs after 2nd retry
return self::DELAY;
} catch (\Exception $e) {
//If there is anything to do.
fwrite(STDERR, Console::ansiFormat($e . "\n", [Console::FG_RED]));
// you can also bury jobs to examine later
return self::BURY;
}
}
【问题讨论】:
标签: php queue beanstalkd