I'am sending Telegram messages with Lumen framework and Telegram bot (messages count is ~ 1400 and it send's via proxy). Each message is a job, which is becomes in the queue. Supervisor get's each job and send messages to users. Job write result data to Lumen log. Some messages get lost and I can't find any information about such messages in log (it seem's such jobs are removed from queue). Why it can happened?
Job code
class ProcessEventSendJob extends Job
{
protected $data;
public $tries = 1;
public $timeout = 30;
public function __construct($data)
{
$this->data = $data;
}
public function handle()
{
$this->telegram = new Telegram(config('telegram.bot.api_key'), config('telegram.bot.name'));
TelegramRequest::setClient(new \GuzzleHttp\Client([
'base_uri' => 'https://api.telegram.org',
'proxy' => 'https://proxy_user:proxy_password@proxy_ip:8000',
'verify' => false,
'timeout' => 30,
]));
...
$result = TelegramRequest::sendMessage($data);
Log::info('Send message', ['result' => $result,]);
}
}
supervisord.conf
[inet_http_server]
port=127.0.0.1:9001
[supervisord]
logfile=/tmp/supervisord.log ; main log file; default $CWD/supervisord.log
logfile_maxbytes=50MB ; max main logfile bytes b4 rotation; default 50MB
logfile_backups=10 ; # of main logfile backups; 0 means none, default 10
loglevel=info ; log level; default info; others: debug,warn,trace
pidfile=/tmp/supervisord.pid ; supervisord pidfile; default supervisord.pid
nodaemon=false ; start in foreground if true; default false
minfds=1024 ; min. avail startup file descriptors; default 1024
minprocs=200 ; min. avail process descriptors;default 200
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
[program:lumen-worker]
command=/usr/bin/php /home/www/salesbox-sb1.ru/artisan queue:work --tries=1
autostart=true
autorestart=true
startsecs=10
startretries=1
process_name=%(program_name)s_%(process_num)02d
numprocs=8
stopwaitsecs=10
user=nginx
log_stdout=true
log_stderr=true
logfile=/var/log/lumen-worker.log
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire