fix(telegram): clean up update offset on channels remove --delete (#18233)

This commit is contained in:
yinghaosang
2026-02-17 01:51:48 +08:00
committed by Peter Steinberger
parent b91e43714b
commit 6757a9fedc
4 changed files with 156 additions and 0 deletions

View File

@@ -80,3 +80,19 @@ export async function writeTelegramUpdateOffset(params: {
await fs.chmod(tmp, 0o600);
await fs.rename(tmp, filePath);
}
export async function deleteTelegramUpdateOffset(params: {
accountId?: string;
env?: NodeJS.ProcessEnv;
}): Promise<void> {
const filePath = resolveTelegramUpdateOffsetPath(params.accountId, params.env);
try {
await fs.unlink(filePath);
} catch (err) {
const code = (err as { code?: string }).code;
if (code === "ENOENT") {
return;
}
throw err;
}
}