fix: serialize telegram media-group processing
This commit is contained in:
@@ -33,6 +33,7 @@
|
|||||||
- Tests/Agents: add regression coverage for workspace tool path resolution and bash cwd defaults.
|
- Tests/Agents: add regression coverage for workspace tool path resolution and bash cwd defaults.
|
||||||
- iOS/Android: enable stricter concurrency/lint checks; fix Swift 6 strict concurrency issues + Android lint errors (ExifInterface, obsolete SDK check). (#662) — thanks @KristijanJovanovski.
|
- iOS/Android: enable stricter concurrency/lint checks; fix Swift 6 strict concurrency issues + Android lint errors (ExifInterface, obsolete SDK check). (#662) — thanks @KristijanJovanovski.
|
||||||
- iOS/macOS: share `AsyncTimeout`, require explicit `bridgeStableID` on connect, and harden tool display defaults (avoids missing-resource label fallbacks).
|
- iOS/macOS: share `AsyncTimeout`, require explicit `bridgeStableID` on connect, and harden tool display defaults (avoids missing-resource label fallbacks).
|
||||||
|
- Telegram: serialize media-group processing to avoid missed albums under load.
|
||||||
- Docs: showcase entries for ParentPay, R2 Upload, iOS TestFlight, and Oura Health. (#650) — thanks @henrino3.
|
- Docs: showcase entries for ParentPay, R2 Upload, iOS TestFlight, and Oura Health. (#650) — thanks @henrino3.
|
||||||
|
|
||||||
## 2026.1.9
|
## 2026.1.9
|
||||||
|
|||||||
@@ -238,6 +238,7 @@ export function createTelegramBot(opts: TelegramBotOptions) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const mediaGroupBuffer = new Map<string, MediaGroupEntry>();
|
const mediaGroupBuffer = new Map<string, MediaGroupEntry>();
|
||||||
|
let mediaGroupProcessing: Promise<void> = Promise.resolve();
|
||||||
|
|
||||||
const cfg = opts.config ?? loadConfig();
|
const cfg = opts.config ?? loadConfig();
|
||||||
const account = resolveTelegramAccount({
|
const account = resolveTelegramAccount({
|
||||||
@@ -1228,14 +1229,24 @@ export function createTelegramBot(opts: TelegramBotOptions) {
|
|||||||
existing.messages.push({ msg, ctx });
|
existing.messages.push({ msg, ctx });
|
||||||
existing.timer = setTimeout(async () => {
|
existing.timer = setTimeout(async () => {
|
||||||
mediaGroupBuffer.delete(mediaGroupId);
|
mediaGroupBuffer.delete(mediaGroupId);
|
||||||
|
mediaGroupProcessing = mediaGroupProcessing
|
||||||
|
.then(async () => {
|
||||||
await processMediaGroup(existing);
|
await processMediaGroup(existing);
|
||||||
|
})
|
||||||
|
.catch(() => undefined);
|
||||||
|
await mediaGroupProcessing;
|
||||||
}, MEDIA_GROUP_TIMEOUT_MS);
|
}, MEDIA_GROUP_TIMEOUT_MS);
|
||||||
} else {
|
} else {
|
||||||
const entry: MediaGroupEntry = {
|
const entry: MediaGroupEntry = {
|
||||||
messages: [{ msg, ctx }],
|
messages: [{ msg, ctx }],
|
||||||
timer: setTimeout(async () => {
|
timer: setTimeout(async () => {
|
||||||
mediaGroupBuffer.delete(mediaGroupId);
|
mediaGroupBuffer.delete(mediaGroupId);
|
||||||
|
mediaGroupProcessing = mediaGroupProcessing
|
||||||
|
.then(async () => {
|
||||||
await processMediaGroup(entry);
|
await processMediaGroup(entry);
|
||||||
|
})
|
||||||
|
.catch(() => undefined);
|
||||||
|
await mediaGroupProcessing;
|
||||||
}, MEDIA_GROUP_TIMEOUT_MS),
|
}, MEDIA_GROUP_TIMEOUT_MS),
|
||||||
};
|
};
|
||||||
mediaGroupBuffer.set(mediaGroupId, entry);
|
mediaGroupBuffer.set(mediaGroupId, entry);
|
||||||
|
|||||||
Reference in New Issue
Block a user