mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 08:44:07 -04:00
fix: delete background jobs by id when cleaning up
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
78fd195e6a
commit
40442f5337
3 changed files with 14 additions and 2 deletions
|
|
@ -135,7 +135,7 @@ class JobList implements IJobList {
|
|||
}
|
||||
}
|
||||
|
||||
protected function removeById(int $id): void {
|
||||
public function removeById(int $id): void {
|
||||
$query = $this->connection->getQueryBuilder();
|
||||
$query->delete('jobs')
|
||||
->where($query->expr()->eq('id', $query->createNamedParameter($id, IQueryBuilder::PARAM_INT)));
|
||||
|
|
|
|||
|
|
@ -79,6 +79,14 @@ interface IJobList {
|
|||
*/
|
||||
public function remove($job, $argument = null): void;
|
||||
|
||||
/**
|
||||
* Remove a job from the list by id
|
||||
*
|
||||
* @param int $id
|
||||
* @since 30.0.0
|
||||
*/
|
||||
public function removeById(int $id): void;
|
||||
|
||||
/**
|
||||
* check if a job is in the list
|
||||
*
|
||||
|
|
|
|||
|
|
@ -53,7 +53,11 @@ abstract class QueuedJob extends Job {
|
|||
* @since 25.0.0
|
||||
*/
|
||||
final public function start(IJobList $jobList): void {
|
||||
$jobList->remove($this, $this->argument);
|
||||
if ($this->id) {
|
||||
$jobList->removeById($this->id);
|
||||
} else {
|
||||
$jobList->remove($this, $this->argument);
|
||||
}
|
||||
parent::start($jobList);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue