Commit Graph

71 Commits (08e62bece99ab59624b363aec64400a499991561)

Author SHA1 Message Date
Julien Veyssier d967151f52
fix(bg-jobs): review adjustments
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
2024-05-02 16:43:42 +07:00
Julien Veyssier 1acc57b5c0
feat(bg-jobs): allow setting a job class list instead of a single class in cron.php and the job worker occ command
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
2024-05-02 16:43:41 +07:00
Marcel Klehr 352d79deee
fix(bg-jobs): fix psalm issues
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2024-05-02 16:43:41 +07:00
Marcel Klehr a3d8632fbe
fix(bg-jobs): fix minor issues
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2024-05-02 16:43:41 +07:00
Julius Härtl 8400bfee01
feat(bg-jobs): Add background worker occ command
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2024-05-02 16:43:41 +07:00
Julius Härtl 52eb6d8726
feat(bg-jobs): Allow calling cron.php with a background job class
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2024-05-02 16:43:40 +07:00
Côme Chilliet ec5133b739 fix: Apply new coding standard to all files
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-04-02 14:16:21 +07:00
Côme Chilliet 303e2febc7
Merge pull request #43387 from nextcloud/fix/migrate-away-from-ilogger-in-jobs 2024-02-08 18:27:44 +07:00
Louis Chemineau 898df41de9
Revert "Merge branch 'master' of github.com:nextcloud/server"
This reverts commit d9d60238c7, reversing
changes made to ba3fdb0cdc.
2024-02-08 15:31:19 +07:00
Côme Chilliet e78e27187a chore: Delete deprecated internal Job classes
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-02-08 10:28:29 +07:00
Joas Schilling 4cb5501a3f
fix(cron): Reset the reserved_at when force executing from CLI
Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-12-20 10:07:41 +07:00
Anna Larch dc87c531b5 fix(joblist): also reset last_run timestamp on updating an existing job
Signed-off-by: Anna Larch <anna@nextcloud.com>
2023-12-15 11:49:51 +07:00
Marcel Klehr cbd304c8f0 fix(JobList#hasReservedJob): Break tie when multiple jobs are reserved
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2023-11-06 10:47:40 +07:00
Christoph Wurst 04ecc2a6a9
feat(backgroundjob): Schedule job after <timestamp>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2023-09-29 10:29:40 +07:00
Marcel Klehr 9f4b3de03c Fix ParallelAwareJob tests
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2023-07-28 11:12:32 +07:00
Louis Chemineau 8ad2f34045 Remove job from oc_jobs when the file is not findable
When an application is disabled, or when a background jobs is removed by the app developer, then the job won't be found. In those cases, it makes sense to remove those jobs from oc_job.

Signed-off-by: Louis Chemineau <louis@chmn.me>
2023-05-03 10:39:38 +07:00
Marcel Klehr 524d053eb2 JobList: add debug log when hasReservedJob query fails
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2023-04-24 17:16:32 +07:00
Marcel Klehr 5a7f023bfc JobList#hasReservedJobs: Close cursor
so Joas doesn't die

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2023-04-23 12:36:12 +07:00
Marcel Klehr 5608b50778 Fix BackgroundJob tests
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2023-04-23 12:36:12 +07:00
Marcel Klehr 6f9a3218d0 Update lib/private/BackgroundJob/JobList.php
Co-authored-by: Joas Schilling <213943+nickvergessen@users.noreply.github.com>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2023-04-23 12:36:12 +07:00
Marcel Klehr 1296f3612e test(BackgroundJobs): Add tests for allowParallelRuns and hasReservedJobs
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2023-04-23 12:36:12 +07:00
Marcel Klehr c01c516323 feat(BackgroundJobs): Allow preventing parallel runs for a job class
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2023-04-23 12:36:12 +07:00
Côme Chilliet d74044f634
Fix API breakage by using a new method instead
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-01-12 17:18:59 +07:00
Côme Chilliet e74f464662
Remove deprecated method getAll instead of breaking API on deprecated method
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-01-12 17:13:08 +07:00
Côme Chilliet 679682c186
Use a Generator for job list to fix background-job:list command
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-01-10 18:20:31 +07:00
Carl Schwan 49334e4d9c
Fix many tests and warnings
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-08-08 17:03:51 +07:00
Carl Schwan 48d9c4d2b0
Port existing server code to new interface
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-08-08 17:03:19 +07:00
Côme Chilliet 2e921f8b3d Fix typing in IJobList
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-07-11 09:46:23 +07:00
Côme Chilliet 868d748dbf Code cleaning of Background/ListCommand
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-07-11 09:46:23 +07:00
Côme Chilliet 3d01179907 Add command to list jobs
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-07-11 09:46:23 +07:00
Côme Chilliet 0b7779b6ff Clean up JobList class
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-07-11 09:46:22 +07:00
Christoph Wurst b17c4a6072 Check background job type
It is assumed that a job class loaded from the jobs table is an IJob,
but due to programming error the job might be of another type. Then the
setters will most likely fail.

This patch adds an interface type check so only correct jobs are used,
anything else is ignored.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2022-05-31 15:24:30 +07:00
Kirill Popov 0b27b9e658 Get not only time-sensitive next job from list but any
Before the change webcron used to select
**only** time-sensitive tasks.

Signed-off-by: Kirill Popov <kirill.s.popov@gmail.com>
2022-04-24 21:55:53 +07:00
Carl Schwan c870bd1968 Do chuncked job deletion
This is helpful in cases where we are deleting tons jobs at the same
time in a gallera cluster. This doesn't happen often but this can create
issues.

Test plan:

1. Use https://github.com/nextcloud/quota_warning/pull/88
2. Change max to 1
3. Enabled/Disable quota_warning app and see jobs getting sucessfully
   added and removed

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-03-17 21:41:58 +07:00
Joas Schilling abcf45e336
Also use hashed/indexed column on delete
Signed-off-by: Joas Schilling <coding@schilljs.com>
2022-03-02 09:23:16 +07:00
Christoph Wurst ef4c18a266
Deprecate our old, internal background job base classes
The OCP ones should be used instead. This makes it more visible in our
IDEs that the base class of background job should be replaced.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2022-02-22 11:31:54 +07:00
Joas Schilling b765f79368
Allow apps to specify if their background job can be delayed
Signed-off-by: Joas Schilling <coding@schilljs.com>
2022-02-07 13:54:54 +07:00
Julius Härtl 99b2cf8339
Add hashed attribute column for indexed job existence check
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2022-01-18 14:01:24 +07:00
Carl Schwan 6312c0df69
Check style update
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-01-13 00:19:07 +07:00
Julius Härtl b30193ed14
Reset job disabling timer on adding the job again
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2022-01-03 12:12:02 +07:00
Joas Schilling 7239b3d560
Bump since version
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-10-14 09:57:16 +07:00
Joas Schilling 9cd9f4b4bc
Move queries to the joblist
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-10-14 09:57:16 +07:00
John Molakvoæ (skjnldsv) 215aef3cbd
Update php licenses
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-06-04 22:02:41 +07:00
Christoph Wurst d89a75be0b
Update all license headers for Nextcloud 21
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-12-16 18:48:22 +07:00
Morris Jobke 99c9423766
Remove @suppress SqlInjectionChecker
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-09-16 15:53:56 +07:00
Christoph Wurst 2a054e6c04
Update the license headers for Nextcloud 20
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-08-24 14:54:25 +07:00
Morris Jobke 16d83ab30a
Remove getLastJob from IJobList
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-08-13 21:50:06 +07:00
Morris Jobke b1cdd0dd9b
Use formal type hints instead of informal PHPDoc
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-07-06 10:13:23 +07:00
Daniel Kesselberg 9b10d35477
Fix wrong phpdoc for execute method
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2020-07-03 10:47:15 +07:00
Christoph Wurst cb057829f7
Update license headers for 19
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-29 11:57:22 +07:00