hhxsv5 / laravel-s

LaravelS is an out-of-the-box adapter between Laravel/Lumen and Swoole.
MIT License
3.82k stars 471 forks source link

Task::deliver投递任务,重启代码后,任务就会丢失 #472

Closed unitesw closed 1 month ago

unitesw commented 1 month ago

投递任务,重启代码后,任务就会丢失

unitesw commented 1 month ago

本地使用fswatch重启后,延时任务全部丢失

unitesw commented 1 month ago

[2024-06-03 05:44:10] [INFO] The max time of waiting to forcibly stop is 60s. [2024-06-03 05:44:10] [INFO] Waiting Swoole[PID=78986] to stop

unitesw commented 1 month ago

这边我的需求是延时通过ws提醒用户,但是如果采用laravel redis队列,根本不能使用app('swoole'),因为不同的cli之间无法通信,无奈只能采用laravel-s的ws推送,但是laravel-s的异步任务延时投递,一旦重启代码,就会存在丢失的情况

hhxsv5 commented 1 month ago

延时ws推送肯定需要把要推送的消息落库的,推送前落库记录状态,推送成功后更改状态。再起个CustomProcess定时补偿那些超时未推的消息。