fix(backup): exclude TDLib's disposable file cache from the tdlib tar
continuous-integration/drone/push Build is passing

files/temp is TDLib's own redundant download cache — the worker
already prunes it after every ingestion run (see the recent
optimizeTdlibStorage fix), and its content still lives in the
source/destination Telegram chats regardless. With the cache grown
back to ~59GB between prune cycles, tarring it made today's backup
run for 4+ hours straight, fighting the actively-ingesting worker for
disk I/O and degrading the whole host. Excluding it keeps the backup
to what's actually irreplaceable: the DB dump and the TDLib session
state itself.
This commit is contained in:
2026-08-14 11:40:03 +02:00
parent b8672a44d0
commit d8e01f3398
+7 -1
View File
@@ -19,7 +19,13 @@ pg_dump -h dragonsstash-db -U "$POSTGRES_USER" -d "$POSTGRES_DB" -Fc -f "$DUMP_F
# TDLib volumes are tarred live (best-effort, per design). A file changing # TDLib volumes are tarred live (best-effort, per design). A file changing
# mid-read makes GNU tar exit 1 (warning) — that is expected here and must not # mid-read makes GNU tar exit 1 (warning) — that is expected here and must not
# abort the backup. Only a genuine error (exit >= 2) is fatal. # abort the backup. Only a genuine error (exit >= 2) is fatal.
tar --warning=no-file-changed -czf "$TAR_FILE" -C /data tdlib-worker tdlib-bot \ #
# files/temp is TDLib's own disposable download cache (redundant with the
# source/destination Telegram chats, pruned by the worker itself after each
# ingestion run) — it has no business in a backup and its size is what made
# this tar take 4+ hours once the cache grew back to tens of GB.
tar --warning=no-file-changed --exclude='tdlib-worker/*/files/temp' \
-czf "$TAR_FILE" -C /data tdlib-worker tdlib-bot \
|| { rc=$?; [ "$rc" -le 1 ] || exit "$rc"; } || { rc=$?; [ "$rc" -le 1 ] || exit "$rc"; }
restic backup "$DUMP_FILE" "$TAR_FILE" restic backup "$DUMP_FILE" "$TAR_FILE"