INNER CODE UNIT · Python
_begin_maintenance
AaronL725/grok-register · web/server.py:66
def _begin_maintenance(kind: str) -> None:
global _maintenance_state
with _job_lock:
if _job_state["running"]:
raise HTTPException(status_code=409, detail="注册任务运行期间不能执行维护操作")
if _maintenance_state is not None:
raise HTTPException(
status_code=409,
detail="已有维护操作正在执行: %s" % _maintenance_state,
)
_maintenance_state = str(kind)
def _end_maintenance(kind: str) -> None:
global _maintenance_state
with _job_lock:
if _maintenance_state == str(kind):
_maintenance_state = None