mirror of
https://github.com/xCyanGrizzly/DragonsStash.git
synced 2026-05-11 14:21:15 +00:00
Fix worker getting stuck during sync: add timeouts, stuck detection, and safety limits
- Add invokeWithTimeout wrapper for TDLib API calls (2min timeout per call) - Add stuck detection to getChannelMessages: break if from_message_id doesn't advance - Add stuck detection to getTopicMessages: same protection for topic scanning - Add stuck detection to getForumTopicList: break if pagination offsets don't advance - Add max page limit (5000) to all scanning loops to prevent infinite pagination - Add mutex wait timeout (30min) to prevent indefinite blocking when holder hangs - Add cycle timeout (4h default, configurable via WORKER_CYCLE_TIMEOUT_MINUTES) - Fix end-of-page detection to use actual limit value instead of hardcoded 100 Co-authored-by: xCyanGrizzly <53275238+xCyanGrizzly@users.noreply.github.com>
This commit is contained in:
18
worker/dist/util/config.d.ts
vendored
Normal file
18
worker/dist/util/config.d.ts
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
export declare const config: {
|
||||
readonly databaseUrl: string;
|
||||
readonly workerIntervalMinutes: number;
|
||||
readonly tempDir: string;
|
||||
readonly tdlibStateDir: string;
|
||||
readonly maxZipSizeMB: number;
|
||||
readonly logLevel: "debug" | "info" | "warn" | "error";
|
||||
readonly telegramApiId: number;
|
||||
readonly telegramApiHash: string;
|
||||
/** Maximum jitter added to scheduler interval (in minutes) */
|
||||
readonly jitterMinutes: 5;
|
||||
/** Maximum time span for multipart archive parts (in hours). 0 = no limit. */
|
||||
readonly multipartTimeoutHours: number;
|
||||
/** Delay between Telegram API calls (in ms) to avoid rate limits */
|
||||
readonly apiDelayMs: 1000;
|
||||
/** Max retries for rate-limited requests */
|
||||
readonly maxRetries: 5;
|
||||
};
|
||||
Reference in New Issue
Block a user