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

[5.x] Exclude jobs from completed overview #1230

Closed
wants to merge 3 commits into from
Closed

Conversation

driesvints
Copy link
Member

@driesvints driesvints commented Dec 20, 2022

Closes #1153

This PR implements a way to exclude certain jobs from the Horizon completed overview. This is handy to filter frequently shown jobs like PingOhDearJob.

'jobs' => [
    'exclude' => [
        PingOhDearJob::class,
    ],
],

@driesvints driesvints changed the title Exclude jobs from completed overview [5.x] Exclude jobs from completed overview Dec 20, 2022
@driesvints
Copy link
Member Author

I managed to crack the changes needed to getJobsByType to properly filter for jobs but now I'm running into an issue with pagination and countJobsByType. Because it returns the count of all jobs, not just the ones filtered by job name, pagination allows you to continue to click to next pages because the total pages count doesn't matches the result set.

We could maybe change countJobsByType to the same inner workings as getJobsByType to retrieve all ids (without mapping them to jobs) to do a full count in PHP of all matching ID's. But this could maybe add a lot of load if there's tons and tons of results.

I'm not sure what the correct way forward is now. If this were a database result set we could just simply do a whereIn 😅

@taylorotwell
Copy link
Member

@driesvints we may be approaching this from the wrong angle entirely which is making our life harder than it needs to be.

Another option to achieve the same results would be to either:

A) Not store excluded jobs that complete at all. See the completed method of RedisJobRepository. This is definitely the easiest approach; however, people may still want some way view information about them, which brings me to:

B) Store excluded jobs in a new category of jobs called "Silenced" or something, with a new tab in the UI. This would also likely be a pretty easy change by modifying the completed method and adding a couple of new methods on the RedisJobRepository.

@driesvints driesvints mentioned this pull request Dec 28, 2022
@driesvints
Copy link
Member Author

@taylorotwell great suggestion! I sent this in: #1232

@driesvints driesvints closed this Dec 28, 2022
@driesvints driesvints deleted the exclude-jobs branch December 28, 2022 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Horizon: Exclude certain jobs from Completed Jobs list
2 participants