Revert "feat: experiment with await + asyncio.gather for multi file in same node"
This reverts commit c08b68c41f8f0bae587675f7592dcdde28d09627.
This commit is contained in:
parent
c08b68c41f
commit
212daa838c
@ -1359,7 +1359,7 @@ async def update_file_status(prompt_id: str, data, uploading, have_error=False,
|
||||
|
||||
async def handle_upload(prompt_id: str, data, key: str, content_type_key: str, default_content_type: str):
|
||||
items = data.get(key, [])
|
||||
upload_tasks = []
|
||||
# upload_tasks = []
|
||||
|
||||
for item in items:
|
||||
# Skipping temp files
|
||||
@ -1375,41 +1375,33 @@ async def handle_upload(prompt_id: str, data, key: str, content_type_key: str, d
|
||||
elif file_extension == '.webp':
|
||||
file_type = 'image/webp'
|
||||
|
||||
upload_tasks.append(upload_file(
|
||||
prompt_id,
|
||||
item.get("filename"),
|
||||
subfolder=item.get("subfolder"),
|
||||
type=item.get("type"),
|
||||
content_type=file_type,
|
||||
item=item
|
||||
))
|
||||
# await upload_file(
|
||||
# upload_tasks.append(upload_file(
|
||||
# prompt_id,
|
||||
# item.get("filename"),
|
||||
# subfolder=item.get("subfolder"),
|
||||
# type=item.get("type"),
|
||||
# content_type=file_type,
|
||||
# item=item
|
||||
# )
|
||||
# ))
|
||||
await upload_file(
|
||||
prompt_id,
|
||||
item.get("filename"),
|
||||
subfolder=item.get("subfolder"),
|
||||
type=item.get("type"),
|
||||
content_type=file_type,
|
||||
item=item
|
||||
)
|
||||
|
||||
# Execute all upload tasks concurrently
|
||||
await asyncio.gather(*upload_tasks)
|
||||
# await asyncio.gather(*upload_tasks)
|
||||
|
||||
# Upload files in the background
|
||||
async def upload_in_background(prompt_id: str, data, node_id=None, have_upload=True, node_meta=None):
|
||||
try:
|
||||
# await handle_upload(prompt_id, data, 'images', "content_type", "image/png")
|
||||
# await handle_upload(prompt_id, data, 'files', "content_type", "image/png")
|
||||
# await handle_upload(prompt_id, data, 'gifs', "format", "image/gif")
|
||||
# await handle_upload(prompt_id, data, 'mesh', "format", "application/octet-stream")
|
||||
upload_tasks = [
|
||||
handle_upload(prompt_id, data, 'images', "content_type", "image/png"),
|
||||
handle_upload(prompt_id, data, 'files', "content_type", "image/png"),
|
||||
handle_upload(prompt_id, data, 'gifs', "format", "image/gif"),
|
||||
handle_upload(prompt_id, data, 'mesh', "format", "application/octet-stream")
|
||||
]
|
||||
|
||||
await asyncio.gather(*upload_tasks)
|
||||
await handle_upload(prompt_id, data, 'images', "content_type", "image/png")
|
||||
await handle_upload(prompt_id, data, 'files', "content_type", "image/png")
|
||||
await handle_upload(prompt_id, data, 'gifs', "format", "image/gif")
|
||||
await handle_upload(prompt_id, data, 'mesh', "format", "application/octet-stream")
|
||||
|
||||
status_endpoint = prompt_metadata[prompt_id].status_endpoint
|
||||
token = prompt_metadata[prompt_id].token
|
||||
|
Loading…
x
Reference in New Issue
Block a user