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
Christoph Wurst
41b5e5923a
Use exactly one empty line after the namespace declaration
...
For PSR2
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-09 11:48:10 +07:00
Christoph Wurst
1a9330cd69
Update the license headers for Nextcloud 19
...
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-31 14:52:54 +07:00
Christoph Wurst
b80ebc9674
Use the short array syntax, everywhere
...
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-26 16:34:56 +07:00
Daniel Kesselberg
018020108b
Make sure to catch php errors during job execution
...
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2020-01-31 16:04:04 +07:00
Georg Ehrke
eda599973d
JobList: Typecast last_run to integer
...
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
2020-01-30 12:01:02 +07:00
Christoph Wurst
5bf3d1bb38
Update license headers
...
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-12-05 15:38:45 +07:00
Roeland Jago Douma
68748d4f85
Some php-cs fixes
...
* Order the imports
* No leading slash on imports
* Empty line before namespace
* One line per import
* Empty after imports
* Emmpty line at bottom of file
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-11-22 20:52:10 +07:00
Christoph Wurst
d5927e4d01
Fix integer background job id type error
...
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-01-15 14:36:03 +07:00
Morris Jobke
f5a1f4bc1b
Revert "Wait for cron to finish before running upgrade command"
...
This reverts commit 18e9631810 .
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-11-01 15:23:40 +07:00
Morris Jobke
79801ad263
Suppress potential SQL injection warning as they are false positives
...
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-07-09 14:55:47 +07:00
Morris Jobke
a1a29d14c8
Unlock failed cron jobs and set a high "last_checked" value to avoid continous re-check
...
* fixes issue where cronjobs of a not-loaded app are marked as "still running" because there is a "reserved_at" value stored
* fixed #9992
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-07-09 14:51:02 +07:00
Morris Jobke
18e9631810
Wait for cron to finish before running upgrade command
...
* fixes #9562
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-06-19 14:22:45 +07:00
Morris Jobke
0eebff152a
Update license headers
...
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-11-06 16:56:19 +07:00