mirror of https://github.com/jumpserver/jumpserver
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
574 B
21 lines
574 B
from orgs.utils import current_org
|
|
from common.utils.lock import DistributedLock
|
|
|
|
|
|
class NodeTreeUpdateLock(DistributedLock):
|
|
name_template = 'assets.node.tree.update.<org_id:{org_id}>'
|
|
|
|
def get_name(self):
|
|
if current_org:
|
|
org_id = current_org.id
|
|
else:
|
|
org_id = 'current_org_is_null'
|
|
name = self.name_template.format(
|
|
org_id=org_id
|
|
)
|
|
return name
|
|
|
|
def __init__(self):
|
|
name = self.get_name()
|
|
super().__init__(name=name, release_on_transaction_commit=True, reentrant=True)
|