add level 4
This commit is contained in:
+3
-7
@@ -1,5 +1,4 @@
|
||||
import asyncio
|
||||
from datetime import datetime, timezone
|
||||
from hashlib import sha256
|
||||
import os
|
||||
from tempfile import TemporaryFile
|
||||
@@ -16,7 +15,6 @@ from .errors import ApiError
|
||||
from .models import Attachment
|
||||
from .routes import get_current_user, get_store
|
||||
from .storage.postgres import PostgresStore
|
||||
from .broker import publish
|
||||
|
||||
router = APIRouter()
|
||||
Image.MAX_IMAGE_PIXELS = 40000000
|
||||
@@ -93,11 +91,9 @@ async def upload(chat_id: UUID, request: Request, filename: str = Query(...),
|
||||
attachment_id, chat_id, user["id"], filename, content_type,
|
||||
size, digest.hexdigest(), key, job_id, connection=connection,
|
||||
)
|
||||
await publish({
|
||||
"schema_version": 1, "job_id": str(job_id), "type": "attachment.process.v1",
|
||||
"attachment_id": str(attachment_id), "pipeline_version": 1, "attempt": 1,
|
||||
"created_at": datetime.now(timezone.utc).isoformat().replace("+00:00", "Z"),
|
||||
})
|
||||
# Fault-injection for level-4 proof: durable outbox must recover this commit.
|
||||
if os.environ.get("OUTBOX_FAULT_AFTER_COMMIT") == "1":
|
||||
os._exit(70)
|
||||
attachment["variants"] = []
|
||||
return attachment
|
||||
except ClientDisconnect:
|
||||
|
||||
Reference in New Issue
Block a user