php利用supervisor和redis的brpop来实现消息队列

supervisor配置

[program:iotvisitorlog]
command=php yiic iotvisitorlog              ; the program (relative uses PATH, can take args)
numprocs=1                    ; number of processes copies to start (def 1)
directory=/opt/www                ; directory to cwd to before exec (def no cwd)
autostart=true                ; start at supervisord start (default: true)
autorestart=unexpected        ; whether/when to restart (default: unexpected)
startretries=1000
user=root

思路:

1、常驻脚本brpop($foo_key, 0 );

2、执行了一个小时 || 处理了一万个任务 || 数据库连接断了   则sleep(5);exit();   让supervisor来重启进程

问题:1、redis最大连接时间超时了怎么办?2、php最大执行时间超过了怎么办?
答:暂未找到设置,有可能是让supervisor来重启

猜你喜欢

转载自blog.csdn.net/weixin_38230961/article/details/111942633