Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't see if a job is delayed when releasing with delay #789

Closed
fgilio opened this issue Mar 6, 2020 · 9 comments
Closed

Can't see if a job is delayed when releasing with delay #789

fgilio opened this issue Mar 6, 2020 · 9 comments
Assignees

Comments

@fgilio
Copy link

fgilio commented Mar 6, 2020

  • Horizon Version: 3.7.2
  • Laravel Version: 6.9.0
  • PHP Version: 7.3.7
  • Redis Driver & Version: predis 1.1.1
  • Database Driver & Version: MySQL 5.7.27

Description:

I saw that #755 added a way to see if a job is delayed, and until when. Which is a really great enhancement, thanks!
I have a job that uses $this->release($delayInSeconds) to put itself back on the queue. And I can't see the badge, or anything related to the delay, in the UI.

Is that taken into account when showing the delay on the UI? Or is it only when initially dispatching the job with a delay.

Thanks!

@driesvints
Copy link
Member

Hey there,

Unfortunately we don't support this version anymore. Please check out our support policy on which versions we are currently supporting. Can you please try to upgrade to the latest version and see if your problem persists? We'll help you out and re-open this issue if so.

Thanks!

@mpskovvang
Copy link

This is also true for version 4.0.2. Please consider reopening the issue @driesvints.

It seems like Horizon displays the badge when the payload contains the delay key, but the payload is only created the first time the job is pushed to the queue. When a job is being deleted and released to the delayed queue, the payload isn't updated with the delay key.

I understand that deleteAndRelease is part of the Laravel core, so the issue might be a little unrelated to Horizon itself.

@driesvints
Copy link
Member

@Cannonb4ll can you maybe check into the questions above?

@Cannonb4ll
Copy link
Contributor

Will do, @mpskovvang can you describe a small replicable case so I can replicate it? Then i'll be able shoot in a PR that fixes this 👏

@mpskovvang
Copy link

Sure @Cannonb4ll. Below is probably the simplest replicable case:

<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;

class Test implements ShouldQueue
{
    use InteractsWithQueue, Queueable;

    public $tries = 3;

    public function handle()
    {
        $this->release(60);
    }
}
$ php artisan tinker
>>> app(\Illuminate\Contracts\Bus\Dispatcher::class)->dispatch(new \App\Jobs\Test());

Horizon will process the job as expected, and release it back to the queue with a delay. The job will be listed in the Pending jobs but without the badge and the tooltip.

Thanks for having a look. The Delayed badge is a great enhancement! 👍

@Cannonb4ll
Copy link
Contributor

Alright, I have done some digging. And it seems that using the release() method does not even inject any data into the job that we can use to display the badge when 'releasing' jobs.

I get the feeling that this is deeper than horizon itself, or a missing key from the Job repository.

I have checked my local redis server for the JSON data:

{"id":"276","created_at":"1584691622.9025","queue":"default","updated_at":"1584691622.9025","name":"App\\Jobs\\ReleaseJob","connection":"redis","payload":"{\"uuid\":\"59873e14-23de-4117-aeb3-943860bf6351\",\"displayName\":\"App\\\\Jobs\\\\ReleaseJob\",\"job\":\"Illuminate\\\\Queue\\\\CallQueuedHandler@call\",\"maxTries\":3,\"maxExceptions\":null,\"delay\":null,\"timeout\":null,\"timeoutAt\":null,\"data\":{\"commandName\":\"App\\\\Jobs\\\\ReleaseJob\",\"command\":\"O:19:\\\"App\\\\Jobs\\\\ReleaseJob\\\":9:{s:5:\\\"tries\\\";i:3;s:6:\\\"\\u0000*\\u0000job\\\";N;s:10:\\\"connection\\\";N;s:5:\\\"queue\\\";N;s:15:\\\"chainConnection\\\";N;s:10:\\\"chainQueue\\\";N;s:5:\\\"delay\\\";N;s:10:\\\"middleware\\\";a:0:{}s:7:\\\"chained\\\";a:0:{}}\"},\"id\":\"276\",\"attempts\":0,\"type\":\"job\",\"tags\":[],\"pushedAt\":\"1584691622.9015\"}","status":"pending"}

In this, I am also unable to find any data related to the release option.

@themsaid Is this known with you? For me it sounds to a missing piece of data from the queue from the Laravel framework itself. Would love to get some help on this one.

@themsaid
Copy link
Member

Hey,

Yes releasing with a delay is not the same as delaying the job. A delayed job never ran, a released job is already delayed by default so even without setting a delay it's considered delayed.

@Cannonb4ll
Copy link
Contributor

Thank you for clarifying. TIL 🏄‍♂️

@mpskovvang I am sorry I was not able to help you on this one, but as Mohammed explained it is intended behaviour.

@mpskovvang
Copy link

I did expect this conclusion, and I do understand the decision behind although an indicator for a released job would have been helpful.

Anyway, thanks for your effort!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants