Allow some GQL operations to silently fail
This commit is contained in:
1 parent
4dcabeeb9e
commit
b20f98da7a
1 file changed
+8
-2
@@ -719,7 +719,8 @@ class Twitch:
|
|||||||
# use the other set to set them online if possible
|
# use the other set to set them online if possible
|
||||||
if acl_channels:
|
if acl_channels:
|
||||||
await asyncio.gather(
|
await asyncio.gather(
|
||||||
*(channel.update_stream(trigger_events=False) for channel in acl_channels)
|
*(channel.update_stream(trigger_events=False) for channel in acl_channels),
|
||||||
|
return_exceptions=True,
|
||||||
)
|
)
|
||||||
# finally, add them as new channels
|
# finally, add them as new channels
|
||||||
new_channels.update(acl_channels)
|
new_channels.update(acl_channels)
|
||||||
@@ -868,12 +869,17 @@ class Twitch:
|
|||||||
handled: bool = False
|
handled: bool = False
|
||||||
|
|
||||||
# Solution 1: use GQL to query for the currently mined drop status
|
# Solution 1: use GQL to query for the currently mined drop status
|
||||||
|
try:
|
||||||
context = await self.gql_request(
|
context = await self.gql_request(
|
||||||
GQL_OPERATIONS["CurrentDrop"].with_variables({"channelID": str(channel.id)})
|
GQL_OPERATIONS["CurrentDrop"].with_variables(
|
||||||
|
{"channelID": str(channel.id)}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
drop_data: JsonType | None = (
|
drop_data: JsonType | None = (
|
||||||
context["data"]["currentUser"]["dropCurrentSession"]
|
context["data"]["currentUser"]["dropCurrentSession"]
|
||||||
)
|
)
|
||||||
|
except GQLException:
|
||||||
|
drop_data = None
|
||||||
if drop_data is not None:
|
if drop_data is not None:
|
||||||
drop = self._drops.get(drop_data["dropID"])
|
drop = self._drops.get(drop_data["dropID"])
|
||||||
if drop is not None and drop.can_earn(channel):
|
if drop is not None and drop.can_earn(channel):
|
||||||
|
|||||||
Reference in new issue
Block a user