mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 20:12:00 -06:00
Called super delete method before deleting JobResult task.
Done to avoid having deleted a task on accident if the deleting of the JobResult fails.
This commit is contained in:
parent
679a9e839b
commit
ef0b455b05
@ -534,14 +534,14 @@ class JobResult(models.Model):
|
||||
return str(self.job_id)
|
||||
|
||||
def delete(self, *args, **kwargs):
|
||||
super().delete(*args, **kwargs)
|
||||
|
||||
queue = django_rq.get_queue("default")
|
||||
job = queue.fetch_job(str(self.job_id))
|
||||
|
||||
if job:
|
||||
job.cancel()
|
||||
|
||||
return super().delete(*args, **kwargs)
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse(f'extras:{self.obj_type.name}_result', args=[self.pk])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user