laravel / telescope

An elegant debug assistant for the Laravel framework.
https://laravel.com/docs/telescope
MIT License
4.83k stars 577 forks source link

Jobs are in pending status! #507

Closed ghost closed 5 years ago

ghost commented 5 years ago

I am using Redis and Horizon to mange my queues..

When I use php artisan queue:work redis to process the jobs , the jobs's status in both Horizon and Telescope is successfully changed to success status.

On the other hand, when using php artisan horizon the jobs are in a success status in Horizon, yet Telescope shows these jobs as in a pending status!

themsaid commented 5 years ago

duplicate of https://github.com/laravel/telescope/issues/503

ghost commented 5 years ago

The job is not running forever, I have added $tries and $timeout to the job..

In my app I am dispatching the job from an Observer and then Horizon will show the status as a success but in Telescope still in a pending status.When I dispatch it from else where Telescope shows the status successfully same as Horizon.

ghost commented 5 years ago

@themsaid

How to reproduce this issue?

1 - run php artisan horizon before dispatching any job.. 2 - dispatch a job from Observer or Events listeners..

It seems that Telescope doesn't catch jobs's events probably in this scenario...

fridzema commented 5 years ago

Same issue here. Horizon says it is finished successfully, but telescope stays pending forever.

ghost commented 5 years ago

@themsaid

is this on your radar?

themsaid commented 5 years ago

I can't replicate it no matter what I test, horizon and telescope are running nicely together. I've seen people report it and then say it's working fine now, so perhaps it's a worker reading old code or something.

ghost commented 5 years ago

I did a fresh laravel install with the same configuration as my old project ( which has the issue ) and everything is working nicely between horizon and telescope like you said.

I will dig more and see whats happening with my old project.


I don't know if I should write this to a separate issue or not.. but an issue I have found when re-queuing the same job again.. telescope shows an empty queue ( for any dispatched job comes after the first one ).

class ProcessPodcast implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    /**
         * @var array
         */
    private $params;

    /**
     * AJob constructor.
     *
     * @param $param1
     */
    public function __construct($param1)
    {
        $this->onQueue('someQueue');
        $this->params = func_get_args();
    }

    public function handle()
    {
        try {
            /**
             * going to do a lot of logic here or throw exception that may cause it to requeue
             */
            throw new \Exception('Requeue');
        } catch (\Exception $exception) {
            // check for "Requeue" and dispatch a new job.
            if ($exception->getMessage() === 'Requeue') {
                $this->dispatch(...$this->params)->onQueue('someQueue')->delay(5);
            }
        }
    }
}

image

jny986 commented 3 years ago

Just incase anyone finds this and is looking for an answer. I had the same issue with Telescope and AWS/SQS queues and found that the problem was fixed by restarting the queue workers.