We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 81adf54 commit 84085d3Copy full SHA for 84085d3
queue_job_batch/models/queue_job.py
@@ -30,3 +30,17 @@ def write(self, vals):
30
# to work with the same batch
31
batch.with_delay(identity_key=identity_exact).check_state()
32
return super().write(vals)
33
+
34
+ def autovacuum(self):
35
+ """Delete batches if all jobs are unlink after job autovacuum
36
+ Called from a cron.
37
+ """
38
39
+ ret = super().autovacuum()
40
+ batches = self.env["queue.job.batch"].search([("job_ids", "=", False)])
41
42
+ for batch in batches:
43
+ if not batch.job_ids:
44
+ batch.unlink()
45
46
+ return ret
0 commit comments