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

Fixes #12105: Prevent data sources from becoming stuck in syncing status when an exception is raised

This commit is contained in:
jeremystretch
2023-03-31 09:52:07 -04:00
parent eb77c0e920
commit bd38b50e5e
2 changed files with 7 additions and 3 deletions

View File

@@ -24,7 +24,10 @@ def sync_datasource(job, *args, **kwargs):
job.terminate()
except (SyncError, JobTimeoutException) as e:
except Exception as e:
job.terminate(status=JobStatusChoices.STATUS_ERRORED)
DataSource.objects.filter(pk=datasource.pk).update(status=DataSourceStatusChoices.FAILED)
logging.error(e)
if type(e) in (SyncError, JobTimeoutException):
logging.error(e)
else:
raise e