vendredi 28 septembre 2018

How to put a delay between failed jobs on listeners

I need to set a delay between specific failed jobs on listeners. I know if specify the onption --delay=5 its works, but I need specific delay on a listener (not on standard job). I try put the property delay on Listener, but doesn't works.

<?php

namespace Froakie\Listeners;

use Carbon\Carbon;
use Froakie\Events\ExampleEvent;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;

/**
 * Class ExampleListener
 *
 * @package Froakie\Listeners
 * @author Miguel Borges <miguel.borges@edirectinsure.com>
 */
class ExampleListener implements ShouldQueue
{
    use InteractsWithQueue;

    /**
     * The number of seconds the job can run before timing out.
     *
     * @var int
     */
    public $timeout = 5;

    /**
     * The number of times the job may be attempted.
     *
     * @var int
     */
    public $tries = 3;

    public $delay = 5;

    public $seconds;

    /**
     * Handle the event.
     *
     * @param \Froakie\Events\ExampleEvent $event
     * @throws \Exception
     */
    public function handle(ExampleEvent $event)
    {
//        $this->delay(5);
            throw new \Exception('test');
    }
}



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2OmnekY
via IFTTT

Aucun commentaire:

Enregistrer un commentaire