mirror of
https://github.com/inventree/InvenTree.git
synced 2026-09-10 06:37:17 +00:00
fix lease issue (#12828)
This commit is contained in:
@@ -4,6 +4,7 @@ Used to serialize an potentially long-running operation,
|
||||
without holding a database transaction open for the duration.
|
||||
"""
|
||||
|
||||
import os
|
||||
import time
|
||||
from datetime import datetime, timedelta
|
||||
from typing import Optional
|
||||
@@ -81,6 +82,10 @@ def acquire_lease_blocking(
|
||||
"""
|
||||
deadline = time.monotonic() + timeout
|
||||
|
||||
if os.environ.get('SETUP_INITIALIZING', '0') == '1':
|
||||
logger.debug("Skipping lease acquisition for '%s' during initialization", key)
|
||||
return True
|
||||
|
||||
while True:
|
||||
if try_acquire_lease(key):
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user