fix: only add batch extras when there are more than one item being processed.
This commit is contained in:
parent
ed6cdf1f92
commit
b5c3bfddc8
1 changed files with 5 additions and 7 deletions
|
|
@ -425,14 +425,12 @@ async def items_add(request: Request, queue: DownloadQueue, encoder: Encoder) ->
|
||||||
if not item.extras:
|
if not item.extras:
|
||||||
item.extras = {}
|
item.extras = {}
|
||||||
|
|
||||||
item.extras["batch_id"] = batch_id
|
if len(items) > 1:
|
||||||
item.extras["batch_index"] = idx
|
item.extras["batch_id"] = batch_id
|
||||||
item.extras["batch_total"] = len(items)
|
item.extras["batch_index"] = idx
|
||||||
|
item.extras["batch_total"] = len(items)
|
||||||
|
|
||||||
task = asyncio.create_task(
|
task = asyncio.create_task(queue.add(item=item), name=f"bulk_add_{batch_id}_{idx}")
|
||||||
queue.add(item=item),
|
|
||||||
name=f"bulk_add_{batch_id}_{idx}",
|
|
||||||
)
|
|
||||||
task.add_done_callback(lambda t: handle_task_exception(t, LOG))
|
task.add_done_callback(lambda t: handle_task_exception(t, LOG))
|
||||||
|
|
||||||
return web.json_response(
|
return web.json_response(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue