@@ -665,12 +665,24 @@ jobs:
665665 id : backend-sha
666666 run : echo "sha=$(git ls-remote https://github.com/nextcloud/recognize_backend HEAD | cut -f1)" >> "$GITHUB_OUTPUT"
667667
668+ # The cache stores a VACUUM INTO snapshot (nextcloud-cache.db), not the
669+ # live data/nextcloud.db: the running dev server / ExApp mutate the live DB
670+ # while actions/cache tars it, which failed the save with "tar exit code 1".
668671 - uses : actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
669672 id : db-cache
670673 with :
671- path : data/ nextcloud.db
674+ path : nextcloud-cache .db
672675 key : ${{ runner.os }}-${{ matrix.server-versions }}-taskprocessing-${{ steps.backend-sha.outputs.sha }}-${{ hashFiles('data/admin/files/**', 'apps/recognize/lib/Classifiers/AbstractTaskProcessingClassifier.php', 'apps/recognize/lib/Classifiers/TaskProcessing/**', 'apps/recognize/lib/TaskProcessing/**', 'apps/recognize/lib/Db/FaceDetectionMapper.php') }}
673676
677+ # On a cache hit, replace the freshly-installed DB with the cached detection
678+ # snapshot so clustering and the detection summary run against it. Drop any
679+ # stale WAL sidecars from the fresh install so SQLite reads the snapshot.
680+ - name : Restore detection DB from snapshot
681+ if : steps.db-cache.outputs.cache-hit == 'true'
682+ run : |
683+ rm -f data/nextcloud.db-wal data/nextcloud.db-shm
684+ cp nextcloud-cache.db data/nextcloud.db
685+
674686 # The remaining classification steps only run on a cache miss. When the
675687 # detection database is restored from cache we can skip deploying the
676688 # ExApp entirely and go straight to clustering (pure PHP).
@@ -777,9 +789,18 @@ jobs:
777789 FAILED=$(sq "select count(*) from oc_taskprocessing_tasks where app_id = 'recognize' and status = 4;")
778790 echo "failed recognize taskprocessing tasks: $FAILED"
779791
792+ # VACUUM INTO writes a consistent point-in-time copy (WAL folded in) that
793+ # actions/cache can tar without the running dev server / ExApp mutating it
794+ # mid-read (which previously failed the save with "tar exit code 1").
795+ - name : Snapshot detection DB for caching
796+ if : steps.db-cache.outputs.cache-hit != 'true'
797+ run : |
798+ sqlite3 -cmd ".timeout 60000" data/nextcloud.db "VACUUM INTO 'nextcloud-cache.db';"
799+
780800 - uses : actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
801+ if : steps.db-cache.outputs.cache-hit != 'true'
781802 with :
782- path : data/ nextcloud.db
803+ path : nextcloud-cache .db
783804 key : ${{ steps.db-cache.outputs.cache-primary-key }}
784805
785806 - name : Reduce space
0 commit comments