Skip to content

Commit a6ec0d5

Browse files
authored
Update channel join rate limit (#196)
It is stated in the IRC guide that channel join rate limit is now 20 joins per 10 seconds. This fixes the old 50/15 to the new 20/10. https://dev.twitch.tv/docs/irc/guide#rate-limits
1 parent 198c7c8 commit a6ec0d5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

twitchio/websocket.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def __init__(
7070
self.is_ready: asyncio.Event = asyncio.Event()
7171
self._join_lock: asyncio.Lock = asyncio.Lock()
7272
self._join_handle = 0
73-
self._join_tick = 50
73+
self._join_tick = 20
7474
self._join_pending = {}
7575
self._join_load = {}
7676
self._init = False
@@ -243,8 +243,8 @@ async def join_channels(self, *channels: str):
243243
async with self._join_lock: # acquire a lock, allowing only one join_channels at once...
244244
for channel in channels:
245245
if self._join_handle < time.time(): # Handle is less than the current time
246-
self._join_tick = 50 # So lets start a new rate limit bucket..
247-
self._join_handle = time.time() + 15 # Set the handle timeout time
246+
self._join_tick = 20 # So lets start a new rate limit bucket..
247+
self._join_handle = time.time() + 10 # Set the handle timeout time
248248

249249
if self._join_tick == 0: # We have exhausted the bucket, wait so we can make a new one...
250250
await asyncio.sleep(self._join_handle - time.time())

0 commit comments

Comments
 (0)