File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 3636 - Corrected :class: `~twitchio.Predictor ` slots and user keys, repr has also been added
3737 - Updated IRC parser to not strip colons from beginning of messages
3838 - Updated IRC parser to not remove multiple spaces when clumped together
39+ - Fixed :func: `twitchio.Client.start ` exiting immediatly
3940
4041- ext.commands
4142 - Bug fixes
Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ def __init__(
9999 self ._events = {}
100100 self ._waiting : List [Tuple [str , Callable [[...], bool ], asyncio .Future ]] = []
101101 self .registered_callbacks : Dict [Callable , str ] = {}
102+ self ._closing : Optional [asyncio .Event ] = None
102103
103104 @classmethod
104105 def from_client_credentials (
@@ -159,7 +160,9 @@ def run(self):
159160 except KeyboardInterrupt :
160161 pass
161162 finally :
162- self .loop .run_until_complete (self .close ())
163+ if not self ._closing .is_set ():
164+ self .loop .run_until_complete (self .close ())
165+
163166 self .loop .close ()
164167
165168 async def start (self ):
@@ -174,21 +177,25 @@ async def start(self):
174177 )
175178 try :
176179 await self .connect ()
180+ await self ._closing .wait ()
177181 finally :
178- await self .close ()
182+ if not self ._closing .is_set ():
183+ await self .close ()
179184
180185 async def connect (self ):
181186 """|coro|
182187
183188 Connects to the twitch IRC server
184189 """
190+ self ._closing = asyncio .Event ()
185191 await self ._connection ._connect ()
186192
187193 async def close (self ):
188194 """|coro|
189195
190196 Cleanly disconnects from the twitch IRC server
191197 """
198+ self ._closing .set ()
192199 await self ._connection ._close ()
193200
194201 def run_event (self , event_name , * args ):
You can’t perform that action at this time.
0 commit comments