async with lock
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-10-19 20:24:47 +08:00
parent f30ad0cb7d
commit fd4c9302c2

View File

@ -157,10 +157,9 @@ class IdiomGame:
"""
跳过当前成语,选择下一个成语
"""
await self.lock.acquire()
self._skip_idiom_async()
self.add_buff_score(buff_score)
self.lock.release()
async with self.lock:
self._skip_idiom_async()
self.add_buff_score(buff_score)
return self.last_idiom
def _skip_idiom_async(self) -> str:
@ -174,9 +173,8 @@ class IdiomGame:
"""
用户发送成语
"""
await self.lock.acquire()
state = self._verify_idiom(idiom, user_id)
self.lock.release()
async with self.lock:
state = self._verify_idiom(idiom, user_id)
return state
def is_nextable(self, last_char: str) -> bool: