调整enter_room计时方式
All checks were successful
ci/woodpecker/push/check_format Pipeline was successful

This commit is contained in:
Elaina 2025-01-30 10:47:46 +08:00
parent c86e7ac651
commit 345ec6e2c5

View file

@ -98,10 +98,12 @@ class EnterRoomSolver(BaseSolver, BaseMixin):
logger.info(f"{translate_room(room)}") logger.info(f"{translate_room(room)}")
self.room = room self.room = room
self.detail = detail self.detail = detail
self.avoid_bug_start_time = datetime.now() self.avoid_bug_start_time = None
super().run() super().run()
def bug_timeout(self) -> bool: def bug_timeout(self) -> bool:
if self.avoid_bug_start_time is None:
self.avoid_bug_start_time = datetime.now()
return datetime.now() > self.avoid_bug_start_time + timedelta(seconds=60) return datetime.now() > self.avoid_bug_start_time + timedelta(seconds=60)
@staticmethod @staticmethod
@ -127,7 +129,7 @@ class EnterRoomSolver(BaseSolver, BaseMixin):
return return
if self.bug_timeout(): # yj的bug if self.bug_timeout(): # yj的bug
self.back() self.back()
self.avoid_bug_start_time = datetime.now() self.avoid_bug_start_time = None
return return
score, scope = config.recog.match2d("control_central") score, scope = config.recog.match2d("control_central")
if score >= 0.7: if score >= 0.7: