首先,祝所有程序员节日快乐。
我们的架构是这样的:
用户下单,产生队列
利用workerman的定时任务监控队列(40个进程 每秒执行一次)
定时任务里处理订单逻辑完成下单,向app发送通知
我的问题是会不会有多个进程同时拿到一个队列任务的情况。
另外,我在php start stop的时候产生了exit with status 9的错误
2017-10-24 13:29:17 pid:20771 Workerman stop
2017-10-24 13:29:17 pid:20771 Workerman is stoping ...
2017-10-24 13:29:17 pid:18710 Workerman Stopping ...
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 worker exit with status 9
2017-10-24 13:29:19 pid:18710 Workerman has been stopped
2017-10-24 13:29:19 pid:20771 Workerman stop success
我不知道是不是因为我自己业务逻辑的问题导致阻塞,请不吝赐教
exit with 9 应该是我自己业务阻塞的问题。
对了,还有一个问题,workerman 定时器也推荐使用 Workerman\Protocols\Http::end() 这个方法来结束当前的任务吗?
Workerman\Protocols\Http::end() 不是用来在定时器中结束任务的。
结束任务直接return就行了。
关闭定时器用Timer::del方法。
关于
如果你没做互斥的话,是有可能的。
好的,感谢耐心回答!