保留装饰器接口兼容性,不再加锁。 数据库写入的并发安全由 with_session(独立 session + 事务)保障, 不同用户操作不同行无竞争,同一用户的签到流程本身是串行的。 原全局锁在高并发时超时会导致写入被静默跳过,反而丢数据。
(func)
| 2 | |
| 3 | |
| 4 | def 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 |
nothing calls this directly
no outgoing calls
no test coverage detected