fix(benchmark): reset SQLite with plain DELETEs instead of ORM deletes

The ORM path fires per-document delete signals, which is very slow at the large tier and fails when the cache backend is unreachable. Matches the TRUNCATE-based resets on the other backends.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Trenton HandClaude Sonnet 5.5 committed 2026-10-30 10:21:57 -07:00
1 parent e9303f0c58
commit 5304e46d5d
1 file changed
+8 -11
+8 -11
View File
@@ -73,17 +73,14 @@ def _reset_mariadb() -> None:
def _reset_sqlite() -> None:
from documents.models import Correspondent
from documents.models import Document
from documents.models import DocumentType
from documents.models import StoragePath
from documents.models import Tag
Document.global_objects.all().delete()
Tag.objects.all().delete()
Correspondent.objects.all().delete()
DocumentType.objects.all().delete()
StoragePath.objects.all().delete()
# Plain DELETEs, the SQLite equivalent of the TRUNCATEs above. ORM deletes
# fire per-document signals and cascade collection, which is far too slow
# at the large tier and needs the cache backend to be reachable.
# constraint_checks_disabled() mirrors MariaDB's SET FOREIGN_KEY_CHECKS = 0.
tables = _reset_table_names()
with connection.constraint_checks_disabled(), connection.cursor() as cursor:
for table in tables:
cursor.execute(f"DELETE FROM {table};")
_delete_all_users_and_groups()