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

Allow calling cron jobs background job class with occ #30359

Merged
merged 12 commits into from
May 6, 2024

Conversation

juliusknorr
Copy link
Member

@juliusknorr juliusknorr commented Dec 21, 2021

This would allow important jobs to be handled in a separate cronjob execution, so they can get executed, even if other jobs have lined up before

e.g. have a separate cron job with php occ background-job:worker OCA\\Files\\BackgroundJob\\ScanFiles

@juliusknorr
Copy link
Member Author

Might be something related to #29204 to have also an occ command to run individual job classes in addition to the list. This would be similar to how Laravel handles queues https://laravel.com/docs/8.x/queues some further things to think about:

  • group multiple classes by their domain/importance
  • have a worker occ command that could be setup as a continuous runner

@solracsf
Copy link
Member

This can also help in this cases: #30273

@szaimen szaimen added 3. to review Waiting for reviews enhancement labels Jan 31, 2022
@szaimen szaimen added this to the Nextcloud 24 milestone Jan 31, 2022
@skjnldsv skjnldsv mentioned this pull request Mar 24, 2022
@blizzz blizzz mentioned this pull request Mar 31, 2022
This was referenced Apr 7, 2022
@PVince81
Copy link
Member

we already have background-job:execute but I heard it doesn't work for all types and requires a job id, not a class name

@juliusknorr
Copy link
Member Author

Sounds like a good idea to rather implement it as an occ which people could still setup as a cron job then.

@blizzz blizzz modified the milestones: Nextcloud 24, Nextcloud 25 Apr 21, 2022
@juliusknorr juliusknorr force-pushed the enh/background-job-class branch from f4735c9 to fa4a716 Compare August 2, 2022 10:23
core/Command/Background/Worker.php Fixed Show fixed Hide fixed
core/Command/Background/Worker.php Fixed Show fixed Hide fixed
core/Command/Background/Worker.php Fixed Show fixed Hide fixed
This was referenced Aug 12, 2022
This was referenced Aug 24, 2022
@juliusknorr juliusknorr force-pushed the enh/background-job-class branch from fa4a716 to d6a4f4f Compare September 1, 2022 09:40
@CarlSchwan CarlSchwan changed the title Allow calling cron.php with a background job class Allow calling cron jobs background job class with occ Sep 5, 2022
Comment on lines 98 to 100
if ((int)$row['count'] === 1) {
$count++;
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do?

core/Command/Background/Worker.php Outdated Show resolved Hide resolved
core/Command/Background/Worker.php Outdated Show resolved Hide resolved
core/Command/Background/Worker.php Outdated Show resolved Hide resolved
lib/private/BackgroundJob/JobList.php Outdated Show resolved Hide resolved
@julien-nc julien-nc force-pushed the enh/background-job-class branch from 5b84f7a to 4c3e83f Compare April 11, 2024 08:58
@julien-nc julien-nc force-pushed the enh/background-job-class branch from 4c3e83f to 4fafa7e Compare April 18, 2024 09:09
@julien-nc julien-nc marked this pull request as ready for review April 18, 2024 09:10
@susnux susnux added this to the Nextcloud 30 milestone Apr 18, 2024
@julien-nc julien-nc force-pushed the enh/background-job-class branch 2 times, most recently from f24e031 to 7f39075 Compare April 23, 2024 09:41
@skjnldsv
Copy link
Member

skjnldsv commented May 2, 2024

Still stale @julien-nc ?
Please adjust labels :)

@julien-nc julien-nc added 3. to review Waiting for reviews and removed 2. developing Work in progress stale Ticket or PR with no recent activity labels May 2, 2024
@julien-nc julien-nc force-pushed the enh/background-job-class branch from 7f39075 to 0eb4cdd Compare May 2, 2024 14:43
@marcelklehr marcelklehr merged commit d1ed8bd into master May 6, 2024
157 checks passed
@marcelklehr marcelklehr deleted the enh/background-job-class branch May 6, 2024 08:23
@juliusknorr
Copy link
Member Author

Thanks @marcelklehr and @julien-nc for picking this one up. 🚀

* @return list<array{class:class-string, count:int}>
* @since 30.0.0
*/
public function countByClass(): array;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@blizzz blizzz mentioned this pull request Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.