mirror of
https://github.com/xCyanGrizzly/DragonsStash.git
synced 2026-09-21 13:31:42 +00:00
fix(worker): prune TDLib's unbounded local file cache after each run
continuous-integration/drone/push Build is failing
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user