

























@@ -110,6 +110,7 @@ import { getTelegramSequentialKey } from "./sequential-key.js";
110110import { cacheSticker, describeStickerImage } from "./sticker-cache.js";
111111import {
112112beginTelegramReplyFence,
113+buildTelegramNonInterruptingReplyFenceKey,
113114buildTelegramReplyFenceLaneKey,
114115endTelegramReplyFence,
115116getTelegramReplyFenceSizeForTests,
@@ -418,22 +419,23 @@ export const dispatchTelegramMessage = async ({
418419accountId: route.accountId,
419420sequentialKey: replyFenceLaneKey,
420421});
422+let activeReplyFenceKey = replyFenceKey.activeKey;
421423let replyFenceGeneration: number | undefined;
422424const replyAbortController = new AbortController();
423425let replyAbortControllerQueued = false;
424426let dispatchWasSuperseded = false;
425427const isDispatchSuperseded = () =>
426428replyFenceGeneration !== undefined &&
427429isTelegramReplyFenceSuperseded({
428-key: replyFenceKey.activeKey,
430+key: activeReplyFenceKey,
429431generation: replyFenceGeneration,
430432});
431433const releaseReplyFence = () => {
432434if (replyFenceGeneration === undefined) {
433435return;
434436}
435437endTelegramReplyFence(
436-replyFenceKey.activeKey,
438+activeReplyFenceKey,
437439replyAbortControllerQueued ? undefined : replyAbortController,
438440);
439441replyFenceGeneration = undefined;
@@ -821,11 +823,17 @@ export const dispatchTelegramMessage = async ({
821823const chunkMode = resolveChunkMode(cfg, "telegram", route.accountId);
822824823825const supersedeReplyFence = shouldSupersedeTelegramReplyFence(ctxPayload);
826+activeReplyFenceKey = supersedeReplyFence
827+ ? replyFenceKey.activeKey
828+ : buildTelegramNonInterruptingReplyFenceKey({
829+activeKey: replyFenceKey.activeKey,
830+laneKey: scopedReplyFenceLaneKey,
831+});
824832if (!isRoomEvent && supersedeReplyFence) {
825833supersedeTelegramReplyFence(replyFenceKey.roomEventKey);
826834}
827835replyFenceGeneration = beginTelegramReplyFence({
828-key: replyFenceKey.activeKey,
836+key: activeReplyFenceKey,
829837supersede: supersedeReplyFence,
830838abortController: replyAbortController,
831839laneKey: scopedReplyFenceLaneKey,
@@ -1468,7 +1476,7 @@ export const dispatchTelegramMessage = async ({
14681476onComplete: () => {
14691477replyAbortControllerQueued = false;
14701478releaseTelegramReplyFenceAbortController(
1471-replyFenceKey.activeKey,
1479+activeReplyFenceKey,
14721480replyAbortController,
14731481);
14741482},
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。