Tuesday, January 30, 2018

Multiple queues on the same server with Laravel Forge - development

Multiple queues on the same server with Laravel Forge

I’ve three of the same Laravel Application running but on different environments using Laravel Forge.

Let’s say these are the three sites:

  • site.com (production)
  • staging.site.com (staging)
  • dev.site.com (develop)

On the production site I run Laravel Horizon to monitor the queues for the production site.

When I run a password reset on my dev.site.com the email is not sending to the user because of Exception which happens in queue.

IlluminateDatabaseEloquentModelNotFoundException: No query results
for model [AppModelsUser]. in
/home/forge/site.com/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:412

If you look closely in the error you’ll see that the errors occurred on the site.com production environment. So an email is put on queue in the develop environment, but is executed in the production environment.

This is my queue.php config:

<?php

return [

    'default' => env('QUEUE_DRIVER', 'high'),

    'connections' => [

        'sync' => [
            'driver' => 'sync',
        ],

        'high' => [
            'driver' => 'redis',
            'connection' => 'default',
            'queue' => 'default',
            'retry_after' => 90,
        ],

        'medium' => [
            'driver' => 'redis',
            'connection' => 'default',
            'queue' => 'default',
            'retry_after' => 90,
        ],

        'low' => [
            'driver' => 'redis',
            'connection' => 'default',
            'queue' => 'default',
            'retry_after' => 90,
        ],

    ],

    'failed' => [
        'database' => env('DB_CONNECTION', 'mysql'),
        'table' => 'failed_jobs',
    ],

];

These are the queue settings on all three environments on Forge:

Laravel Forge Queue config

Is this normal behaviour? Or is there something which I’m doing wrong?



from Laravel Questions and Answers https://laravelquestions.com/php/multiple-queues-on-the-same-server-with-laravel-forge/
via Lzo Media

No comments:

Post a Comment