mirror of
https://github.com/xCyanGrizzly/DragonsStash.git
synced 2026-05-11 06:11:15 +00:00
Fix messagesScanned consistency: use totalScanned from scan results, remove double-counting
Co-authored-by: xCyanGrizzly <53275238+xCyanGrizzly@users.noreply.github.com>
This commit is contained in:
@@ -66,6 +66,7 @@ interface TdFile {
|
|||||||
export interface ChannelScanResult {
|
export interface ChannelScanResult {
|
||||||
archives: TelegramMessage[];
|
archives: TelegramMessage[];
|
||||||
photos: TelegramPhoto[];
|
photos: TelegramPhoto[];
|
||||||
|
totalScanned: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ScanProgressCallback = (messagesScanned: number) => void;
|
export type ScanProgressCallback = (messagesScanned: number) => void;
|
||||||
@@ -161,6 +162,7 @@ export async function getChannelMessages(
|
|||||||
return {
|
return {
|
||||||
archives: archives.reverse(),
|
archives: archives.reverse(),
|
||||||
photos: photos.reverse(),
|
photos: photos.reverse(),
|
||||||
|
totalScanned,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -245,6 +245,7 @@ export async function getTopicMessages(
|
|||||||
return {
|
return {
|
||||||
archives: archives.reverse(),
|
archives: archives.reverse(),
|
||||||
photos: photos.reverse(),
|
photos: photos.reverse(),
|
||||||
|
totalScanned,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -448,8 +448,7 @@ export async function runWorkerForAccount(
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Add scanned messages to global counter
|
// Add scanned messages to global counter
|
||||||
const topicMsgCount = scanResult.archives.length + scanResult.photos.length;
|
counters.messagesScanned += scanResult.totalScanned;
|
||||||
counters.messagesScanned += topicMsgCount;
|
|
||||||
|
|
||||||
if (scanResult.archives.length === 0) {
|
if (scanResult.archives.length === 0) {
|
||||||
accountLog.debug(
|
accountLog.debug(
|
||||||
@@ -523,8 +522,7 @@ export async function runWorkerForAccount(
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Add scanned messages to global counter
|
// Add scanned messages to global counter
|
||||||
const channelMsgCount = scanResult.archives.length + scanResult.photos.length;
|
counters.messagesScanned += scanResult.totalScanned;
|
||||||
counters.messagesScanned += channelMsgCount;
|
|
||||||
|
|
||||||
if (scanResult.archives.length === 0) {
|
if (scanResult.archives.length === 0) {
|
||||||
accountLog.debug({ channelId: channel.id }, "No new archives");
|
accountLog.debug({ channelId: channel.id }, "No new archives");
|
||||||
@@ -688,7 +686,6 @@ async function processOneArchiveSet(
|
|||||||
throttled, counters, topicCreator, sourceTopicId, accountLog,
|
throttled, counters, topicCreator, sourceTopicId, accountLog,
|
||||||
} = ctx;
|
} = ctx;
|
||||||
|
|
||||||
counters.messagesScanned += archiveSet.parts.length;
|
|
||||||
const archiveName = archiveSet.parts[0].fileName;
|
const archiveName = archiveSet.parts[0].fileName;
|
||||||
|
|
||||||
// ── Early skip: check if this archive set was already ingested ──
|
// ── Early skip: check if this archive set was already ingested ──
|
||||||
|
|||||||
Reference in New Issue
Block a user