cleanup code

This commit is contained in:
2020-11-01 14:59:22 +01:00
parent 7dcd271dfd
commit 61bed11a65

View File

@@ -18,7 +18,9 @@ import argparse
import asyncio
import logging
import logging.handlers
import os
import pyinotify
import re
import shutil
import sys
@@ -235,7 +237,8 @@ def add_mask(new_mask, current_mask=False):
async def shutdown(timeout=30):
pending = [ t for t in asyncio.all_tasks() if t is not asyncio.current_task() ]
pending = [t for t in asyncio.all_tasks()
if t is not asyncio.current_task()]
if len(pending) > 0:
logging.info(
f"graceful shutdown, waiting {timeout}s "
@@ -272,6 +275,8 @@ def main():
args = parser.parse_args()
LOGLEVEL = logging.INFO
WATCHES = []
with open(args.config, "r") as c:
exec(c.read(), globals())
@@ -282,10 +287,8 @@ def main():
if args.debug:
loglevel = logging.DEBUG
elif "LOGLEVEL" in globals():
loglevel = LOGLEVEL
else:
loglevel = logging.INFO
loglevel = LOGLEVEL
root_logger = logging.getLogger()
root_logger.setLevel(loglevel)