1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Replace JobResult.set_status() with terminate()

This commit is contained in:
jeremystretch
2023-02-28 15:19:54 -05:00
committed by Jeremy Stretch
parent 697feed257
commit a8c331f88a
5 changed files with 46 additions and 59 deletions

View File

@@ -22,8 +22,9 @@ def sync_datasource(job_result, *args, **kwargs):
# Update the search cache for DataFiles belonging to this source
search_backend.cache(datasource.datafiles.iterator())
job_result.terminate()
except SyncError as e:
job_result.set_status(JobResultStatusChoices.STATUS_ERRORED)
job_result.save()
job_result.terminate(status=JobResultStatusChoices.STATUS_ERRORED)
DataSource.objects.filter(pk=datasource.pk).update(status=DataSourceStatusChoices.FAILED)
logging.error(e)