remove some logging from DownloadQueue

This commit is contained in:
arabcoders 2025-09-23 19:38:31 +03:00
parent e0c299ee21
commit 1ba6c04cf3

View file

@ -186,7 +186,6 @@ class DownloadQueue(metaclass=Singleton):
if item.info.auto_start: if item.info.auto_start:
status[item_id] = "already started" status[item_id] = "already started"
LOG.debug(f"Item {item.info.name()} already started.")
continue continue
item.info.auto_start = True item.info.auto_start = True
@ -200,7 +199,6 @@ class DownloadQueue(metaclass=Singleton):
) )
status[item_id] = "started" status[item_id] = "started"
started = True started = True
LOG.debug(f"Item {item.info.name()} marked as started.")
if started: if started:
self.event.set() self.event.set()
@ -231,12 +229,10 @@ class DownloadQueue(metaclass=Singleton):
if item.started() or item.is_cancelled(): if item.started() or item.is_cancelled():
status[item_id] = "already started" status[item_id] = "already started"
LOG.debug(f"Item {item.info.name()} already started.")
continue continue
if item.info.auto_start is False: if item.info.auto_start is False:
status[item_id] = "not started" status[item_id] = "not started"
LOG.debug(f"Item {item.info.name()} is not set to auto-start.")
continue continue
item.info.auto_start = False item.info.auto_start = False
@ -249,7 +245,6 @@ class DownloadQueue(metaclass=Singleton):
message=f"Download '{item.info.title}' has been paused.", message=f"Download '{item.info.title}' has been paused.",
) )
status[item_id] = "paused" status[item_id] = "paused"
LOG.debug(f"Item {item.info.name()} marked as paused.")
return status return status
@ -1078,19 +1073,19 @@ class DownloadQueue(metaclass=Singleton):
# No items could be processed, back off a bit to avoid busy-waiting. # No items could be processed, back off a bit to avoid busy-waiting.
if 0 == items_processed: if 0 == items_processed:
adaptive_sleep: float = min(adaptive_sleep * 1.5, max_sleep) adaptive_sleep: float = min(adaptive_sleep * 1.5, max_sleep)
LOG.info(f"No download slots available. Backing off for {adaptive_sleep:.2f}s before next attempt.") LOG.debug(f"No download slots available. Backing off for {adaptive_sleep:.2f}s before next attempt.")
else: else:
adaptive_sleep = 0.2 adaptive_sleep = 0.2
await asyncio.sleep(adaptive_sleep) await asyncio.sleep(adaptive_sleep)
async def _download_live(self, _id: str, entry: Download) -> None: async def _download_live(self, _id: str, entry: Download) -> None:
LOG.info(f"Creating temporary worker for entry '{entry.info.name()}'.") LOG.debug(f"Creating temporary worker for entry '{entry.info.name()}'.")
try: try:
await self._download_file(_id, entry) await self._download_file(_id, entry)
finally: finally:
LOG.info(f"Temporary worker for '{entry.info.name()}' completed.") LOG.debug(f"Temporary worker for '{entry.info.name()}' completed.")
async def _download_file(self, id: str, entry: Download) -> None: async def _download_file(self, id: str, entry: Download) -> None:
""" """
@ -1165,11 +1160,9 @@ class DownloadQueue(metaclass=Singleton):
if self.is_paused() or self.queue.empty(): if self.is_paused() or self.queue.empty():
return return
LOG.debug("Checking for stale items in the download queue.")
for _id, item in list(self.queue.items()): for _id, item in list(self.queue.items()):
item_ref = f"{_id=} {item.info.id=} {item.info.title=}" item_ref = f"{_id=} {item.info.id=} {item.info.title=}"
if not item.is_stale(): if not item.is_stale():
LOG.debug(f"Item '{item_ref}' is not stale.")
continue continue
try: try: