国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

定時(shí)任務(wù)多進(jìn)程處理隊(duì)列,會(huì)不會(huì)引起并發(fā)問(wèn)題

johson

首先,祝所有程序員節(jié)日快樂(lè)。

我們的架構(gòu)是這樣的:
用戶下單,產(chǎn)生隊(duì)列
利用workerman的定時(shí)任務(wù)監(jiān)控隊(duì)列(40個(gè)進(jìn)程 每秒執(zhí)行一次)
定時(shí)任務(wù)里處理訂單邏輯完成下單,向app發(fā)送通知

我的問(wèn)題是會(huì)不會(huì)有多個(gè)進(jìn)程同時(shí)拿到一個(gè)隊(duì)列任務(wù)的情況。

另外,我在php start stop的時(shí)候產(chǎn)生了exit with status 9的錯(cuò)誤

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

我不知道是不是因?yàn)槲易约簶I(yè)務(wù)邏輯的問(wèn)題導(dǎo)致阻塞,請(qǐng)不吝賜教

7279 4 0
4個(gè)回答

johson

exit with 9 應(yīng)該是我自己業(yè)務(wù)阻塞的問(wèn)題。

  • 暫無(wú)評(píng)論
johson

對(duì)了,還有一個(gè)問(wèn)題,workerman 定時(shí)器也推薦使用 Workerman\Protocols\Http::end() 這個(gè)方法來(lái)結(jié)束當(dāng)前的任務(wù)嗎?

  • 暫無(wú)評(píng)論
walkor 打賞

Workerman\Protocols\Http::end() 不是用來(lái)在定時(shí)器中結(jié)束任務(wù)的。
結(jié)束任務(wù)直接return就行了。
關(guān)閉定時(shí)器用Timer::del方法。

關(guān)于

會(huì)不會(huì)有多個(gè)進(jìn)程同時(shí)拿到一個(gè)隊(duì)列任務(wù)的情況。

如果你沒(méi)做互斥的話,是有可能的。

  • 暫無(wú)評(píng)論
johson

好的,感謝耐心回答!

  • 暫無(wú)評(píng)論
年代過(guò)于久遠(yuǎn),無(wú)法發(fā)表回答
??