Skip to content

Commit

Permalink
Updated eventloop to stop instead of close
Browse files Browse the repository at this point in the history
  • Loading branch information
sacOO7 committed Sep 29, 2023
1 parent 7edff52 commit f4608cd
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ably/executer/eventloop.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@


class AppEventLoop:
loop: events = None
thread: threading = None
loop: events
thread: threading
active: 'AppEventLoop' = None

def __init__(self):
Expand All @@ -15,7 +15,7 @@ def __init__(self):
@staticmethod
def current() -> 'AppEventLoop':
if (AppEventLoop.active is None or
AppEventLoop.active.loop.is_closed()):
not AppEventLoop.active.loop.is_running()):
AppEventLoop.active = AppEventLoop()
AppEventLoop.active.__create_if_not_exist()
return AppEventLoop.active
Expand All @@ -30,7 +30,6 @@ def __create_if_not_exist(self):
self.thread.start()

def close(self) -> events:
if self.loop is not None and not self.loop.is_closed:
if self.loop is not None and self.loop.is_running():
self.loop.call_soon_threadsafe(self.loop.stop)
self.thread.join()
self.loop.close()

0 comments on commit f4608cd

Please sign in to comment.