Exemplo n.º 1
0
 def _get_challenge(self, gamedb: Database) -> Challenge:
     available_challenge_count = 0
     while available_challenge_count == 0 and not self._stop.is_set():
         log_message("Waiting for next challenge to become available.")
         time.sleep(self._options.game_wait_sleep_interval_sec)
         available_challenges = gamedb.list_challenges(
             challenge_completed_predicate_value=False)
         available_challenge_count = len(available_challenges)
     return available_challenges[0]
Exemplo n.º 2
0
 def _get_next_challenge(self, gamedb: Database) -> Challenge:
     available_challenge_count = 0
     while available_challenge_count == 0 and not self._stop_event.is_set():
         log_message("Waiting for next challenge to become available.")
         time.sleep(self._options.game_wait_sleep_interval_sec)
         available_challenges = gamedb.list_challenges(
             challenge_completed_predicate_value=False)
         available_challenge_count = len(available_challenges)
     challenge = available_challenges[0]
     # return serializable challenge since this gets placed on the event queue.
     return Challenge(id=challenge.id,
                      name=challenge.name,
                      message=challenge.message,
                      complete=challenge.complete)