@@ -49,7 +49,7 @@ def __init__(self, bot: core.Bot) -> None:
4949 self .bot = bot
5050
5151 self .session : aiohttp .ClientSession | None = None
52- self .backoff : ExponentialBackoff = ExponentialBackoff () # type: ignore
52+ self .backoff : ExponentialBackoff [ bool ] = ExponentialBackoff ()
5353 self .websocket : aiohttp .ClientWebSocketResponse | None = None
5454
5555 self .connection_task : asyncio .Task [None ] | None = None
@@ -68,7 +68,7 @@ async def cog_unload(self) -> None:
6868 try :
6969 self .connection_task .cancel ()
7070 except Exception as e :
71- LOGGER .debug (f'Unable to cancel Pythonista API connection_task in "cog_unload": { e } ' )
71+ LOGGER .error (f'Unable to cancel Pythonista API connection_task in "cog_unload": { e } ' )
7272
7373 if self .is_connected ():
7474 assert self .websocket
@@ -78,7 +78,7 @@ async def cog_unload(self) -> None:
7878 try :
7979 self .keep_alive_task .cancel ()
8080 except Exception as e :
81- LOGGER .debug (f'Unable to cancel Pythonista API keep_alive_task in "cog_unload": { e } ' )
81+ LOGGER .error (f'Unable to cancel Pythonista API keep_alive_task in "cog_unload": { e } ' )
8282
8383 def dispatch (self , * , data : dict [str , Any ]) -> None :
8484 subscription : str = data ["subscription" ]
@@ -98,7 +98,7 @@ async def connect(self) -> None:
9898 try :
9999 self .keep_alive_task .cancel ()
100100 except Exception as e :
101- LOGGER .debug (f"Failed to cancel Pythonista API Websocket keep alive. This is likely not a problem: { e } " )
101+ LOGGER .warning (f"Failed to cancel Pythonista API Websocket keep alive. This is likely not a problem: { e } " )
102102
103103 while True :
104104 try :
@@ -108,13 +108,13 @@ async def connect(self) -> None:
108108 LOGGER .critical ("Unable to connect to Pythonista API Websocket, due to an incorrect token." )
109109 return
110110 else :
111- LOGGER .debug (f"Unable to connect to Pythonista API Websocket: { e } ." )
111+ LOGGER .error (f"Unable to connect to Pythonista API Websocket: { e } ." )
112112
113113 if self .is_connected ():
114114 break
115115 else :
116116 delay : float = self .backoff .delay () # type: ignore
117- LOGGER .debug (f'Retrying Pythonista API Websocket connection in "{ delay } " seconds.' )
117+ LOGGER .warning (f'Retrying Pythonista API Websocket connection in "{ delay } " seconds.' )
118118
119119 await asyncio .sleep (delay )
120120
@@ -148,7 +148,7 @@ async def keep_alive(self) -> None:
148148 op : int | None = data .get ("op" )
149149
150150 if op == PAPIWebsocketOPCodes .HELLO :
151- LOGGER .info (f'Received HELLO from Pythonista API: user={ data ["user_id" ]} ' )
151+ LOGGER .debug (f'Received HELLO from Pythonista API: user={ data ["user_id" ]} ' )
152152
153153 elif op == PAPIWebsocketOPCodes .EVENT :
154154 self .dispatch (data = data )
0 commit comments