Clean up debugging code

This commit is contained in:
Joscha 2017-09-08 07:51:09 +00:00
parent b917fed126
commit ccaaf6be3f
2 changed files with 21 additions and 17 deletions

View file

@ -1,8 +1,14 @@
import asyncio
#asyncio.get_event_loop().set_debug(True) # uncomment for asycio debugging mode
import logging import logging
# general (asyncio) logging level
#logging.basicConfig(level=logging.DEBUG) #logging.basicConfig(level=logging.DEBUG)
#logging.basicConfig(level=logging.INFO) #logging.basicConfig(level=logging.INFO)
logging.basicConfig(level=logging.WARNING) logging.basicConfig(level=logging.WARNING)
# yaboli logger level
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
#logger.setLevel(logging.DEBUG) #logger.setLevel(logging.DEBUG)
logger.setLevel(logging.INFO) logger.setLevel(logging.INFO)
@ -14,4 +20,11 @@ from .database import *
from .room import * from .room import *
from .utils import * from .utils import *
__all__ = connection.__all__ + room.__all__ + controller.__all__ + utils.__all__ __all__ = (
bot.__all__ +
connection.__all__ +
controller.__all__ +
database.__all__ +
room.__all__ +
utils.__all__
)

View file

@ -1,14 +1,10 @@
import logging
logger = logging.getLogger(__name__)
import asyncio import asyncio
asyncio.get_event_loop().set_debug(True)
import json import json
import websockets import logging
import socket import socket
#from websockets import ConnectionClosed import websockets
logger = logging.getLogger(__name__)
__all__ = ["Connection"] __all__ = ["Connection"]
@ -35,6 +31,9 @@ class Connection:
Attempt to connect to a room. Attempt to connect to a room.
Returns the task listening for packets, or None if the attempt failed. Returns the task listening for packets, or None if the attempt failed.
max_tries - maximum number of reconnect attempts before stopping
delay - time (in seconds) between reconnect attempts
""" """
logger.debug(f"Attempting to connect, max_tries={max_tries}") logger.debug(f"Attempting to connect, max_tries={max_tries}")
@ -178,15 +177,7 @@ class Connection:
self._spawned_tasks.add(task) self._spawned_tasks.add(task)
# only keep running tasks # only keep running tasks
#tasks = set() self._spawned_tasks = {task for task in self._spawned_tasks if not task.done()}
#for task in self._spawned_tasks:
#if not task.done():
#logger.debug(f"Keeping task: {task}")
#tasks.add(task)
#else:
#logger.debug(f"Deleting task: {task}")
#self._spawned_tasks = tasks
self._spawned_tasks = {task for task in self._spawned_tasks if not task.done()} # TODO: Reenable
def _wait_for_response(self, pid): def _wait_for_response(self, pid):
future = asyncio.Future() future = asyncio.Future()