From d8e01f3398d11f9f808dc831294dd2e7b9ba5b19 Mon Sep 17 00:00:00 2001 From: xCyanGrizzly Date: Fri, 14 Aug 2026 11:40:03 +0200 Subject: [PATCH] fix(backup): exclude TDLib's disposable file cache from the tdlib tar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- backup/backup.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/backup/backup.sh b/backup/backup.sh index cc415f7..8102c21 100644 --- a/backup/backup.sh +++ b/backup/backup.sh @@ -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 # 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. -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"; } restic backup "$DUMP_FILE" "$TAR_FILE"