Watch restart after claiming drop adjustment

This commit is contained in:
DevilXD committed 2022-01-07 22:41:37 +01:00
1 parent 30f8f3f5c5
commit 15d127bedd
1 file changed
+5 -4
+5 -4
View File
@@ -420,10 +420,11 @@ class Twitch:
if not mined or campaign.remaining_drops == 0: if not mined or campaign.remaining_drops == 0:
self.change_state(State.INVENTORY_FETCH) self.change_state(State.INVENTORY_FETCH)
return return
# About 4-6s after claiming the drop, next drop can be started # About 4-20s after claiming the drop, next drop can be started
# by re-sending the watch payload # by re-sending the watch payload. We can test for it by fetching the current drop
# via GQL, and then comparing drop IDs.
await asyncio.sleep(4) await asyncio.sleep(4)
for attempt in range(6): for attempt in range(8):
context = await self.gql_request(GQL_OPERATIONS["CurrentDrop"]) context = await self.gql_request(GQL_OPERATIONS["CurrentDrop"])
drop_data: JsonType = context["data"]["currentUser"]["dropCurrentSession"] drop_data: JsonType = context["data"]["currentUser"]["dropCurrentSession"]
with open("log.txt", 'a') as file: with open("log.txt", 'a') as file:
@@ -431,7 +432,7 @@ class Twitch:
if drop_data["dropID"] != drop.id: if drop_data["dropID"] != drop.id:
self.restart_watching() self.restart_watching()
break break
await asyncio.sleep(1) await asyncio.sleep(2)
return return
assert msg_type == "drop-progress" assert msg_type == "drop-progress"
if self._drop_update is None: if self._drop_update is None: