mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-15 08:12:18 -06:00
19644 Make atomic use correct database instead of default (#19651)
* 19644 set atomic transactions to appropriate database * 19644 set atomic transactions for Job Script run * 19644 set atomic transactions to appropriate database * 19644 set atomic transactions to appropriate database * 19644 fix review comments * 19644 fix review comments
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from django.apps import apps
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.db import transaction
|
||||
from django.db import router, transaction
|
||||
|
||||
|
||||
def compile_path_node(ct_id, object_id):
|
||||
@@ -53,7 +53,7 @@ def rebuild_paths(terminations):
|
||||
for obj in terminations:
|
||||
cable_paths = CablePath.objects.filter(_nodes__contains=obj)
|
||||
|
||||
with transaction.atomic():
|
||||
with transaction.atomic(using=router.db_for_write(CablePath)):
|
||||
for cp in cable_paths:
|
||||
cp.delete()
|
||||
create_cablepath(cp.origins)
|
||||
|
||||
Reference in New Issue
Block a user