Skip to content

Commit

Permalink
app: Close the event loop after run() finishes
Browse files Browse the repository at this point in the history
Avoids python issue 23548
  • Loading branch information
chfoo committed Jun 6, 2016
1 parent 41cdc38 commit 2f69428
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions wpull/application/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,17 @@ def stop(self):
if self._current_pipeline:
self._current_pipeline.stop()

def run_sync(self):
def run_sync(self) -> int:
'''Run the application.
This function is blocking.
Returns:
int: The exit status.
'''
return asyncio.get_event_loop().run_until_complete(self.run())
exit_status = asyncio.get_event_loop().run_until_complete(self.run())
asyncio.get_event_loop().close()
return exit_status

@asyncio.coroutine
def run(self):
Expand Down

0 comments on commit 2f69428

Please sign in to comment.