mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fixes #11660: Catch RQ timeout exception when syncing data sources
This commit is contained in:
@@ -4,6 +4,7 @@ from netbox.search.backends import search_backend
|
||||
from .choices import *
|
||||
from .exceptions import SyncError
|
||||
from .models import DataSource
|
||||
from rq.timeouts import JobTimeoutException
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -23,7 +24,7 @@ def sync_datasource(job, *args, **kwargs):
|
||||
|
||||
job.terminate()
|
||||
|
||||
except SyncError as e:
|
||||
except (SyncError, JobTimeoutException) as e:
|
||||
job.terminate(status=JobStatusChoices.STATUS_ERRORED)
|
||||
DataSource.objects.filter(pk=datasource.pk).update(status=DataSourceStatusChoices.FAILED)
|
||||
logging.error(e)
|
||||
|
Reference in New Issue
Block a user