Fix a bug with not claiming one of the two drops;

if two of them happened to be earned at the same time.
This commit is contained in:
DevilXD committed 2022-01-30 20:57:33 +01:00
1 parent 0388fdc290
commit 88d7ffa520
2 files changed
+7 -6

No files matched your search

+2 -2
View File
@@ -455,9 +455,9 @@ class CampaignProgress:
# tray
tray = self._manager.tray
tray.display_progress(drop)
if countdown:
# reschedule our seconds update timer
self.stop_timer()
if countdown:
# restart our seconds update timer
self.start_timer()
elif subone:
# display the current remaining time at 0 seconds (after substracting the minute)
+5 -4
View File
@@ -489,9 +489,6 @@ class Twitch:
self.gui.tray.notify(claim_text, "Mined Drop")
else:
logger.error(f"Drop claim failed! Drop ID: {drop_id}")
if not mined or campaign.remaining_drops == 0:
self.change_state(State.GAMES_UPDATE)
return
# About 4-20s after claiming the drop, next drop can be started
# by re-sending the watch payload. We can test for it by fetching the current drop
# via GQL, and then comparing drop IDs.
@@ -500,9 +497,13 @@ class Twitch:
context = await self.gql_request(GQL_OPERATIONS["CurrentDrop"])
drop_data: JsonType = context["data"]["currentUser"]["dropCurrentSession"]
if drop_data["dropID"] != drop.id:
self.restart_watching()
# When two drops are ready to be claimed, we receive an update only for one.
# This means we have to refresh the games list and claim any additional drops
# after each earned drop, claimed or not.
break
await asyncio.sleep(2)
# This also restarts the watch loop as needed here.
self.change_state(State.GAMES_UPDATE)
return
assert msg_type == "drop-progress"
watching_channel = self.watching_channel.get_with_default(None)