diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2017-03-25 18:20:16 +0100 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2017-03-25 18:20:16 +0100 |
| commit | 7a69ec99048c4f08b6623527c0271d7fb01c0072 (patch) | |
| tree | 9638f2f8c111fc5240a13eea09f9899b0c8c3831 | |
| parent | 7eb8795a2d80b0c83b2b38711cebfd27a2ae7d3b (diff) | |
| download | discordbot-7a69ec99048c4f08b6623527c0271d7fb01c0072.tar.gz discordbot-7a69ec99048c4f08b6623527c0271d7fb01c0072.zip | |
wait for 'done' event
| -rw-r--r-- | main.py | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1,4 +1,5 @@ #!/usr/bin/env python3 +# TODO one request blocks the whole event loop. import logging import os @@ -150,8 +151,7 @@ async def vainsocial(name: str): # TODO here is the problem ^ don't work in closures :( if args[0] in ["process_finished", "compile_finished"]: do_update = True - if args[0] in ["grab_failed", "process_finished", - "compile_finished"]: + if args[0] == "done": wait_for_update = False io = SocketIO("localhost", 8080, LoggingNamespace) @@ -160,7 +160,7 @@ async def vainsocial(name: str): asyncio.ensure_future(request_update()) has_embed = False - for _ in range(10): # try for 10s + for _ in range(30): # try for s if do_update: logging.info("%s: updating bot response", name) @@ -175,6 +175,7 @@ async def vainsocial(name: str): name) if not wait_for_update: break + io.wait(seconds=1) if has_embed: |
