MCPcopy Create free account
hub / github.com/Loping151/RoverSign / with_lock

Function with_lock

RoverSign/utils/database/_lock.py:4–16  ·  view source on GitHub ↗

保留装饰器接口兼容性,不再加锁。 数据库写入的并发安全由 with_session(独立 session + 事务)保障, 不同用户操作不同行无竞争,同一用户的签到流程本身是串行的。 原全局锁在高并发时超时会导致写入被静默跳过,反而丢数据。

(func)

Source from the content-addressed store, hash-verified

2
3
4def with_lock(func):
5 """保留装饰器接口兼容性,不再加锁。
6
7 数据库写入的并发安全由 with_session(独立 session + 事务)保障,
8 不同用户操作不同行无竞争,同一用户的签到流程本身是串行的。
9 原全局锁在高并发时超时会导致写入被静默跳过,反而丢数据。
10 """
11
12 @wraps(func)
13 async def wrapper(*args, **kwargs):
14 return await func(*args, **kwargs)
15
16 return wrapper

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected