Skip to content

Commit

Permalink
Sidetrack2: remove busy loop to wait for toyapp
Browse files Browse the repository at this point in the history
New toy app register their dbus name after the JS application
is loaded so there is no need to busy wait for it.

https://phabricator.endlessm.com/T29266
  • Loading branch information
Juan Pablo Ugarte committed Feb 11, 2020
1 parent 40bfdec commit 7cff397
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions eosclubhouse/quests/hack2/sidetrack2.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,7 @@ def step_begin(self):
self.ask_for_app_launch(message_id='LAUNCH')

highest_level = self._app.get_js_property('highestAchievedLevel')

# @fixme: This is a workaround to https://phabricator.endlessm.com/T29180
# Sometimes Sidetrack app takes lot of time to start and get_js_property times out.
if highest_level is None:
logger.debug('Quest %s: Cannot get \'highestAchievedLevel\' for %s. Trying again...',
self.get_id(), self.app.dbus_name)
return self.step_begin

# This is a workaround to wait until the sidetrack app reads the
# information from the game state service. In the future we should add
# a signal or a property to the toyapps and move this wait to a new
# method in Quest
current_level = int(self._app.get_js_property('currentLevel'))
while current_level == 0:
logger.debug(f'Current level is 0, waiting for sidetrack to load data')
self.pause(1)
current_level = self._app.get_js_property('currentLevel')

if highest_level < 23 or highest_level > 28:
self._app.set_js_property('highestAchievedLevel', ('u', 23))
Expand Down

0 comments on commit 7cff397

Please sign in to comment.