Tuesday, 14 May 2019

Laravel beanstalkd queue repeating jobs before retry time

I've configured a queuing on Laravel 5.4 using the "beanstalkd" queue driver ... I deployed it on CentOS 7 (cPanel) and installed Supervisor... but I've two main problems

  1. In the logs, I found this exception "local.ERROR: exception 'PDOException' with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table '{dbname}.failed_jobs' doesn't exist" So Question #1 is .. Should I configure any database tables for "beanstalkd" queue driver, If so could you please state these tables structure?

  2. Also I've configured the queue:work command in the Supervisor config file as following

[program:test-queue]
process_name=%(program_name)s_%(process_num)02d
command=php /home/****/****/artisan queue:work beanstalkd --sleep=3 --tries=3
autostart=true
autorestart=true
user=gcarpet
numprocs=8
redirect_stderr=true
stdout_logfile= /home/*****/*****/storage/logs/supervisor.log

  1. I found that the supervisor.log contained multiple calls for the job even after the first call was "Processed" .. Question #2 I dispatched the job once but the job was pushed in to the queue several times, I need a solution for this problem I don't want the same job to pushed multiple times in the queue?

    [2019-05-14 09:08:15] Processing: App\Jobs\{JobName}
    [2019-05-14 09:08:15] Processing: App\Jobs\{JobName}
    [2019-05-14 09:08:15] Failed:     App\Jobs\{JobName}
    [2019-05-14 09:08:24] Processed:  App\Jobs\{JobName}
    [2019-05-14 09:08:24] Processing: App\Jobs\{JobName}
    [2019-05-14 09:08:33] Processed:  App\Jobs\{JobName}
    [2019-05-14 09:08:33] Processing: App\Jobs\{JobName}
    [2019-05-14 09:08:41] Processed:  App\Jobs\{JobName}
    [2019-05-14 09:08:41] Processing: App\Jobs\{JobName}
    [2019-05-14 09:08:41] Failed:     App\Jobs\{JobName}
    
    
    1. Please note the time difference between processed and failed jobs, Also I had set the driver 'retry_after' to 900 once and to 90 another time .. And I didn't feel it made any difference.


from Laravel beanstalkd queue repeating jobs before retry time

No comments:

Post a Comment