mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-29 19:36:20 -05:00
Setting sqlalchemy debug when setting global debug.
This commit is contained in:
parent
6e08654828
commit
0ac8923ecc
2 changed files with 8 additions and 9 deletions
9
main.py
9
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()
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue