Skip to content

Commit

Permalink
Fixes #68: Added PYTAK_NO_HELLO to disable initial Hello Event on con…
Browse files Browse the repository at this point in the history
…nect.
  • Loading branch information
ampledata committed Jan 3, 2025
1 parent a127a4a commit f7caf83
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pytak/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,16 +329,18 @@ def __init__(
self.max_in_queue
)

if bool(self._config.get("DEBUG") or 0):
if isinstance(self._config, SectionProxy) and bool(self._config.get("DEBUG")):
for handler in self._logger.handlers:
handler.setLevel(logging.DEBUG)

@property
def config(self):
"""Return the config object."""
return self._config

@config.setter
def config(self, val):
"""Set the config object."""
self._config = val

async def create_workers(self, i_config):
Expand Down Expand Up @@ -409,7 +411,9 @@ async def run(self):
"""Run this Thread and its associated coroutine tasks."""
self._logger.info("Run: %s", self.__class__.__name__)

await self.hello_event()
if not self.config.get("PYTAK_NO_HELLO", False):
await self.hello_event()

self.run_tasks()

done, _ = await asyncio.wait(
Expand Down

0 comments on commit f7caf83

Please sign in to comment.