fix(files): isolate archive workers and make handoff event driven

This commit is contained in:
2026-09-08 07:47:18 +02:00
parent ff84812f7f
commit 13433514b9
11 changed files with 945 additions and 86 deletions
+9 -16
View File
@@ -1,5 +1,6 @@
from __future__ import annotations
from contextlib import closing
from io import BytesIO
from pathlib import Path
import random
@@ -204,24 +205,16 @@ class NativeArchivePerformanceTests(unittest.TestCase):
"govoplan_files.backend.storage.archives.native_zip_library",
return_value=proxy,
),
patch(
"govoplan_files.backend.storage.archives.create_file_asset",
side_effect=FileStorageError("Destination failure"),
),
):
with self.assertRaisesRegex(FileStorageError, "Destination failure"):
extract_archive_upload(
object(),
tenant_id="tenant",
owner_type="user",
owner_id="user",
user_id="user",
archive_data=self.archive,
filename="archive.zip",
folder="",
campaign_id=None,
password="fixture-only",
)
# This unit test owns the native handle locally; public imports
# now own it in a fresh child (covered by worker cleanup tests).
with closing(_read_selected_zip_members(
self.archive, selected_files=set(self.contents), password="fixture-only",
max_file_bytes=100_000, max_total_bytes=100_000,
)) as members:
next(members)
raise FileStorageError("Destination failure")
close.assert_called_once()
def test_native_read_enforces_actual_member_and_total_limits(self):