-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Feature
Copy link
Labels
status: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: housekeepingChanges to the application which do not directly impact the end userChanges to the application which do not directly impact the end user
Milestone
Description
NetBox version
v4.2.1
Feature type
Change to existing functionality
Triage priority
I volunteer to perform this work (if approved)
Proposed functionality
The snippet of code below, used to enqueue DataSource syncing, is duplicated in the following files: netbox/core/api/views.py and netbox/core/views.py
# Enqueue the sync job & update the DataSource's status
job = SyncDataSourceJob.enqueue(instance=datasource, user=request.user)
datasource.status = DataSourceStatusChoices.QUEUED
DataSource.objects.filter(pk=datasource.pk).update(status=datasource.status)I propose moving the status update code to a new enqueue method on SyncDataSourceJob.
Use case
It removes duplicated code, and the logic can be reused easily for new functionalities (e.g., #18287) or to trigger DataSource syncing from plugins.
Database changes
None.
External dependencies
None.
Metadata
Metadata
Assignees
Labels
status: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: housekeepingChanges to the application which do not directly impact the end userChanges to the application which do not directly impact the end user