Added a debug function that counts all current tasks

This commit is contained in:
Jacob Henry 2018-11-28 19:52:13 -05:00
parent 1850ee8718
commit 3446558487
2 changed files with 3 additions and 1 deletions

View File

@ -5,6 +5,7 @@ from typing import List, Any, AsyncGenerator, Coroutine, TypeVar
from slackclient import SlackClient # Obvious from slackclient import SlackClient # Obvious
import channel_util import channel_util
import sys
import slack_util import slack_util
# Read the API token # Read the API token
@ -62,6 +63,7 @@ class ClientWrapper(object):
Asynchronous tasks that eternally reads and responds to messages. Asynchronous tasks that eternally reads and responds to messages.
""" """
async for t in self.spool_tasks(): async for t in self.spool_tasks():
sys.stdout.flush()
if DEBUG_MODE: if DEBUG_MODE:
await t await t

View File

@ -54,7 +54,7 @@ def main() -> None:
wrap.add_passive(periodicals.RemindJobs()) wrap.add_passive(periodicals.RemindJobs())
event_loop = asyncio.get_event_loop() event_loop = asyncio.get_event_loop()
event_loop.set_debug(True) event_loop.set_debug(client_wrapper.DEBUG_MODE)
message_handling = wrap.respond_messages() message_handling = wrap.respond_messages()
passive_handling = wrap.run_passives() passive_handling = wrap.run_passives()
both = asyncio.gather(message_handling, passive_handling) both = asyncio.gather(message_handling, passive_handling)