Skip to content

Commit 41c2c41

Browse files
committed
lock get_model
1 parent e5c8aec commit 41c2c41

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

netbox_custom_objects/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class UniquenessConstraintTestError(Exception):
6868
def thread_safe_model_generation(func):
6969
"""
7070
Decorator to ensure thread-safe model generation.
71-
71+
7272
This decorator prevents race conditions when multiple threads try to generate
7373
the same custom object model simultaneously. It uses per-model locks to ensure
7474
only one thread can generate a specific model at a time, while allowing
@@ -81,7 +81,7 @@ def wrapper(self, *args, **kwargs):
8181
if self.id not in self._model_cache_locks:
8282
self._model_cache_locks[self.id] = threading.RLock()
8383
model_lock = self._model_cache_locks[self.id]
84-
84+
8585
# Use the per-model lock for thread safety
8686
with model_lock:
8787
return func(self, *args, **kwargs)

0 commit comments

Comments
 (0)