Skip to content

Store the ExoPlayer cache flag in a column instead of calling Python from SQL - #255

Merged
abrignoni merged 1 commit into
mainfrom
fix/exo-cache-flag-column
Oct 1, 2026
Merged

abrignoni merged 1 commit into
mainfrom
fix/exo-cache-flag-column

Conversation

@abrignoni

Copy link
Copy Markdown
Owner

Stores whether a row is an ExoPlayer cache file in a column, so no Python function runs inside SQLite on the shared case connection. Fixes #254.

  • files.exo_cache is set when a row is written and when its name changes.
  • Opening an older case adds the column and fills it once.
  • The sidebar counts and the three container Type filters read the column and return the same rows as before.
  • A new test reads the counts while another thread writes, under a timeout. It froze on the old code.

Co-Authored-By: Claude Opus 5.5 [email protected]

…on from SQL

v2026.5.3 registered a Python SQL function, is_exo_cache_name, on the one
connection every thread shares. The sidebar's container counts and the three
container Type filters called it once per container row. A query calling it
holds SQLite's connection mutex and waits for the interpreter lock on each
row, while a thread binding a parameter holds the interpreter lock and waits
for that mutex, so opening the gallery of a case with many container rows
froze the server.

files.exo_cache now holds the answer. It is decided by exoprobe's rule when
upsert_file inserts a row and again when a write changes orig_path, rel_path
or path. Opening a case adds the column if it is missing and fills every row
that has no value, found through a partial index so a case with none pays
nothing. No function is registered on the connection any more, and a test
fails if one comes back.

tests/test_container_kinds.py reads the counts and filters from one thread
while another writes, in a child process under a timeout. On the code before
this change it froze on 10 runs of 10; with it, 15 runs of 15 finished in
about 3 s. The filters and counts return the same rows as before on a
fixture of archives, documents and cache pieces.

Fixes #254

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@abrignoni
abrignoni enabled auto-merge October 1, 2026 15:01
@abrignoni
abrignoni merged commit 314d093 into main Oct 1, 2026
8 checks passed
@abrignoni
abrignoni deleted the fix/exo-cache-flag-column branch October 1, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v2026.5.3 freezes when a case with many container rows is opened

1 participant