Реализовать асинхронную обработку вложений
This commit is contained in:
@@ -74,7 +74,7 @@ async def _load_attachments(
|
||||
await session.execute(
|
||||
select(
|
||||
AttachmentRow.id,
|
||||
AttachmentRow.object_key,
|
||||
AttachmentRow.original_key,
|
||||
AttachmentRow.status,
|
||||
AttachmentRow.updated_at,
|
||||
)
|
||||
@@ -88,7 +88,7 @@ async def _metadata_key_exists(
|
||||
) -> bool:
|
||||
async with sessions() as session:
|
||||
attachment_id = await session.scalar(
|
||||
select(AttachmentRow.id).where(AttachmentRow.object_key == object_key).limit(1)
|
||||
select(AttachmentRow.id).where(AttachmentRow.original_key == object_key).limit(1)
|
||||
)
|
||||
return attachment_id is not None
|
||||
|
||||
@@ -165,7 +165,7 @@ async def reconcile(
|
||||
update(AttachmentRow)
|
||||
.where(
|
||||
AttachmentRow.id == attachment.id,
|
||||
AttachmentRow.object_key == attachment.object_key,
|
||||
AttachmentRow.original_key == attachment.object_key,
|
||||
AttachmentRow.status == 'ready',
|
||||
AttachmentRow.updated_at == attachment.updated_at,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user