From 0ac8923eccab48d09882156b161e921a615bf472 Mon Sep 17 00:00:00 2001 From: Roland Date: Thu, 17 Feb 2022 13:55:51 -0700 Subject: [PATCH] Setting sqlalchemy debug when setting global debug. --- main.py | 9 ++++++--- wrolpi/downloader.py | 8 ++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/main.py b/main.py index ddf6ae40..aca4cdd8 100755 --- a/main.py +++ b/main.py @@ -122,10 +122,13 @@ async def set_log_level(args): Set the level at the root logger so all children that have been created (or will be created) share the same level. """ root_logger = logging.getLogger() + sa_logger = logging.getLogger('sqlalchemy.engine') if args.verbose == 1: root_logger.setLevel(logging.INFO) + sa_logger.setLevel(logging.INFO) elif args.verbose and args.verbose >= 2: root_logger.setLevel(logging.DEBUG) + sa_logger.setLevel(logging.DEBUG) # Always warn about the log level so we know what will be logged effective_level = logger.getEffectiveLevel() @@ -137,6 +140,9 @@ async def set_log_level(args): @limit_concurrent(1) def periodic_downloads(app: Sanic, loop): """A simple function that perpetually calls downloader_manager.do_downloads() after sleeping.""" + # Set all downloads to new. + download_manager.reset_downloads() + config = get_config() if config.wrol_mode: logger.warning(f'Not starting download worker because WROL Mode is enabled.') @@ -149,9 +155,6 @@ def periodic_downloads(app: Sanic, loop): logger.info('Starting download manager.') - # Set all downloads to new. - download_manager.reset_downloads() - async def _periodic_download(): download_manager.renew_recurring_downloads() download_manager.delete_old_once_downloads() diff --git a/wrolpi/downloader.py b/wrolpi/downloader.py index f533cfad..19f58f45 100644 --- a/wrolpi/downloader.py +++ b/wrolpi/downloader.py @@ -444,9 +444,7 @@ class DownloadManager: @optional_session def get_recurring_downloads(self, session: Session = None, limit: int = None): - """ - Get all Downloads that will be downloaded in the future. - """ + """Get all Downloads that will be downloaded in the future.""" query = session.query(Download).filter( Download.frequency != None # noqa ).order_by( @@ -461,9 +459,7 @@ class DownloadManager: @optional_session def get_once_downloads(self, session: Session = None, limit: int = None): - """ - Get all Downloads that will not reoccur. - """ + """Get all Downloads that will not reoccur.""" query = session.query(Download).filter( Download.frequency == None # noqa ).order_by(