You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#relays = ["wss://echo.websocket.org", "wss://echo.websocket.org", "wss://echo.websocket.org" ] # more gives "too many requests" error
16
19
relays= ["wss://echo.websocket.org", "wss://echo.websocket.org", "wss://echo.websocket.org", "wss://echo.websocket.org", "wss://echo.websocket.org" ] # more might give "too many requests" error
17
20
wslist= []
@@ -51,7 +54,7 @@ async def closeall(self):
51
54
forwsinself.wslist:
52
55
awaitws.close()
53
56
54
-
asyncdefmain(self) ->None:
57
+
asyncdefrun_main(self) ->None:
55
58
tasks= []
56
59
self.wslist= []
57
60
foridx, wsurlinenumerate(self.relays):
@@ -89,10 +92,12 @@ async def main(self) -> None:
89
92
awaitasyncio.sleep(1)
90
93
self.assertGreaterEqual(self.on_close_called, min(len(self.relays),self.max_allowed_connections), "on_close was called for less than allowed connections")
91
94
92
-
self.assertEqual(self.on_error_called, len(self.relays) -self.max_allowed_connections, "expecting one error per failed connection")
95
+
self.assertEqual(self.on_error_called, max(0, len(self.relays) -self.max_allowed_connections), "expecting one error per failed connection")
93
96
94
97
# Wait for *all* of them to finish (or be cancelled)
0 commit comments