fix(worker): prune TDLib's unbounded local file cache after each run
continuous-integration/drone/push Build is failing

TDLib keeps a permanent local copy of every file it downloads or
uploads (via inputFileLocal) with no automatic cleanup. Across the two
worker accounts this had grown to ~270GB, filling the host disk to 91%
and triggering a cascading disk-full failure in the bot's TDLib
session on 2026-08-05. Call optimizeStorage after every ingestion run
to clear it; a 5-minute immunity_delay protects files an in-flight
operation might still reference.
This commit is contained in:
2026-08-10 08:17:51 +02:00
parent 148d688d43
commit 7bc57ec227
2 changed files with 33 additions and 1 deletions
+2 -1
View File
@@ -42,7 +42,7 @@ import {
isTopicFetchEnabled,
} from "./db/queries.js";
import type { ActivityUpdate } from "./db/queries.js";
import { createTdlibClient, closeTdlibClient } from "./tdlib/client.js";
import { createTdlibClient, closeTdlibClient, optimizeTdlibStorage } from "./tdlib/client.js";
import {
getAccountChats,
joinChatByInviteLink,
@@ -1203,6 +1203,7 @@ export async function runWorkerForAccount(
accountLog.info({ counters }, "Ingestion run completed");
} finally {
await throttled.flush();
await optimizeTdlibStorage(client, account.id);
await closeTdlibClient(client);
}
} catch (err) {