fix downloader
This commit is contained in:
@@ -726,8 +726,10 @@ async def url_handler(client: Client, message: Message):
|
||||
return
|
||||
|
||||
# Add to queue (with duplicate URL check) AFTER saving to database
|
||||
logger.info(f"Adding task {task_id} to queue (URL: {url[:50]}...)")
|
||||
success = await task_queue.add_task(task, check_duplicate_url=True)
|
||||
if not success:
|
||||
logger.warning(f"Failed to add task {task_id} to queue (duplicate or error)")
|
||||
# If failed to add to queue, remove from database
|
||||
try:
|
||||
async with get_async_session_local()() as session:
|
||||
@@ -745,7 +747,11 @@ async def url_handler(client: Client, message: Message):
|
||||
|
||||
# Start executor if not already started
|
||||
if not task_executor._running:
|
||||
logger.info(f"Starting task executor for task {task_id}")
|
||||
await task_executor.start()
|
||||
logger.info(f"Task executor started, workers should begin processing tasks")
|
||||
else:
|
||||
logger.debug(f"Task executor already running, task {task_id} will be processed by existing workers")
|
||||
|
||||
# Send initial status message and save message_id for updates
|
||||
from bot.modules.task_scheduler.executor import set_task_message
|
||||
|
||||
Reference in New Issue
Block a user