Skip to content

Commit 54598d3

Browse files
committed
remove thread lock
1 parent 3b23759 commit 54598d3

File tree

3 files changed

+0
-45
lines changed

3 files changed

+0
-45
lines changed

netbox_custom_objects/__init__.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,12 @@
11
import sys
2-
import threading
32
import warnings
4-
from functools import wraps
53

64
from django.db import transaction
75
from django.db.utils import DatabaseError, OperationalError, ProgrammingError
86
from netbox.plugins import PluginConfig
97

108
from .constants import APP_LABEL as APP_LABEL
119

12-
# Global lock for plugin ready method
13-
_plugin_ready_lock = threading.RLock()
14-
15-
16-
def thread_safe_plugin_ready(func):
17-
"""
18-
Decorator to ensure thread-safe plugin ready method execution.
19-
"""
20-
@wraps(func)
21-
def wrapper(self, *args, **kwargs):
22-
with _plugin_ready_lock:
23-
return func(self, *args, **kwargs)
24-
return wrapper
25-
2610

2711
def is_running_migration():
2812
"""
@@ -67,7 +51,6 @@ class CustomObjectsPluginConfig(PluginConfig):
6751
required_settings = []
6852
template_extensions = "template_content.template_extensions"
6953

70-
@thread_safe_plugin_ready
7154
def ready(self):
7255
from .models import CustomObjectType
7356
from netbox_custom_objects.api.serializers import get_serializer_class

netbox_custom_objects/decorators.py

Lines changed: 0 additions & 25 deletions
This file was deleted.

netbox_custom_objects/models.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
from utilities.validators import validate_regex
5252

5353
from netbox_custom_objects.constants import APP_LABEL, RESERVED_FIELD_NAMES
54-
from netbox_custom_objects.decorators import thread_safe_model_generation
5554
from netbox_custom_objects.field_types import FIELD_TYPE_CLASS
5655
from netbox_custom_objects.utilities import generate_model
5756

@@ -444,7 +443,6 @@ def register_custom_object_search_index(self, model):
444443
label = f"{APP_LABEL}.{self.get_table_model_name(self.id).lower()}"
445444
registry["search"][label] = search_index
446445

447-
@thread_safe_model_generation
448446
def get_model(
449447
self,
450448
skip_object_fields=False,
@@ -550,7 +548,6 @@ def wrapped_post_through_setup(self, cls):
550548

551549
return model
552550

553-
@thread_safe_model_generation
554551
def get_model_with_serializer(self):
555552
from netbox_custom_objects.api.serializers import get_serializer_class
556553
model = self.get_model()

0 commit comments

Comments
 (0)