fixed last calls to emit that were awaiting
This commit is contained in:
parent
2eba728dd2
commit
63f6ca0cf4
2 changed files with 19 additions and 28 deletions
|
|
@ -639,7 +639,7 @@ class DownloadQueue(metaclass=Singleton):
|
||||||
item.template = _preset.template
|
item.template = _preset.template
|
||||||
|
|
||||||
yt_conf = {}
|
yt_conf = {}
|
||||||
cookie_file = Path(self.config.temp_path) / f"c_{uuid.uuid4().hex}.txt"
|
cookie_file: Path = Path(self.config.temp_path) / f"c_{uuid.uuid4().hex}.txt"
|
||||||
|
|
||||||
LOG.info(f"Adding '{item.__repr__()}'.")
|
LOG.info(f"Adding '{item.__repr__()}'.")
|
||||||
|
|
||||||
|
|
@ -780,16 +780,12 @@ class DownloadQueue(metaclass=Singleton):
|
||||||
self.done.put(dlInfo)
|
self.done.put(dlInfo)
|
||||||
|
|
||||||
LOG.info(log_message)
|
LOG.info(log_message)
|
||||||
await asyncio.gather(
|
self._notify.emit(Events.LOG_INFO, data={}, title="Ignored Download", message=log_message)
|
||||||
*[
|
self._notify.emit(
|
||||||
self._notify.emit(Events.LOG_INFO, data={}, title="Ignored Download", message=log_message),
|
Events.ITEM_MOVED,
|
||||||
self._notify.emit(
|
data={"to": "history", "preset": dlInfo.info.preset, "item": dlInfo.info},
|
||||||
Events.ITEM_MOVED,
|
title="Download History Update",
|
||||||
data={"to": "history", "preset": dlInfo.info.preset, "item": dlInfo.info},
|
message=f"Download history updated with '{item.url}'.",
|
||||||
title="Download History Update",
|
|
||||||
message=f"Download history updated with '{item.url}'.",
|
|
||||||
),
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
return {"status": "ok"}
|
return {"status": "ok"}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -431,23 +431,18 @@ class Tasks(metaclass=Singleton):
|
||||||
timeNow = datetime.now(UTC).isoformat()
|
timeNow = datetime.now(UTC).isoformat()
|
||||||
ended: float = time.time()
|
ended: float = time.time()
|
||||||
LOG.info(f"Task '{task.name}' completed at '{timeNow}' took '{ended - started:.2f}' seconds.")
|
LOG.info(f"Task '{task.name}' completed at '{timeNow}' took '{ended - started:.2f}' seconds.")
|
||||||
|
self._notify.emit(
|
||||||
_tasks = [
|
Events.TASK_DISPATCHED,
|
||||||
self._notify.emit(
|
data={**status, "preset": task.preset} if status else {"preset": task.preset},
|
||||||
Events.TASK_DISPATCHED,
|
title=f"Task '{task.name}' dispatched",
|
||||||
data={**status, "preset": task.preset} if status else {"preset": task.preset},
|
message=f"Task '{task.name}' dispatched at '{timeNow}'.",
|
||||||
title=f"Task '{task.name}' dispatched",
|
)
|
||||||
message=f"Task '{task.name}' dispatched at '{timeNow}'.",
|
self._notify.emit(
|
||||||
),
|
Events.LOG_SUCCESS,
|
||||||
self._notify.emit(
|
data={"preset": task.preset, "lowPriority": True},
|
||||||
Events.LOG_SUCCESS,
|
title="Task completed",
|
||||||
data={"preset": task.preset, "lowPriority": True},
|
message=f"Task '{task.name}' completed in '{ended - started:.2f}'.",
|
||||||
title="Task completed",
|
)
|
||||||
message=f"Task '{task.name}' completed in '{ended - started:.2f}'.",
|
|
||||||
),
|
|
||||||
]
|
|
||||||
|
|
||||||
await asyncio.gather(*_tasks)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error(f"Failed to execute '{task.name}' at '{timeNow}'. '{e!s}'.")
|
LOG.error(f"Failed to execute '{task.name}' at '{timeNow}'. '{e!s}'.")
|
||||||
self._notify.emit(
|
self._notify.emit(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue