Setting sqlalchemy debug when setting global debug.

This commit is contained in:
Roland 2022-02-17 13:55:51 -07:00
parent 6e08654828
commit 0ac8923ecc
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
2 changed files with 8 additions and 9 deletions

View file

@ -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()

View file

@ -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(