Skip to content

Commit

Permalink
Make back button work again
Browse files Browse the repository at this point in the history
  • Loading branch information
Ketok4321 committed Aug 15, 2023
1 parent c2dd247 commit 386c82c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/speedtest_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,21 @@ def __init__(self, view, server):

def run(self):
event_loop = asyncio.new_event_loop()
event_loop.run_until_complete(self.do_start())

event_loop.run_until_complete(self.run_async())
event_loop.close()

async def do_start(self): # TODO: Try except
async def run_async(self):
task = asyncio.create_task(self.do_run())

while not task.done():
if self.stop_event.is_set():
task.cancel()
break

await asyncio.sleep(0)

async def do_run(self): # TODO: Try except
GLib.idle_add(setattr, self.view, "ping", str(round(await ping(self.server), 1)) + "ms")

def dlCallback(speed, progress):
Expand Down

0 comments on commit 386c82c

Please sign in to comment.