Skip to content

Commit ea66872

Browse files
committed
test(telegram): cover native claimNext drain stalls
1 parent 25a99f2 commit ea66872

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

extensions/telegram/src/polling-session.test.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,13 +1682,24 @@ describe("TelegramPollingSession", () => {
16821682
const queue = createChannelIngressQueue({ ...options, channelId: "telegram" });
16831683
return {
16841684
...queue,
1685-
claim: async (...args: Parameters<typeof queue.claim>) => {
1686-
if (args[0] === "0000000000000043" && !blockedSecondClaim) {
1685+
claimNext: async (...args: Parameters<typeof queue.claimNext>) => {
1686+
const claimOptions = args[0];
1687+
const blockedLaneKeys = claimOptions?.blockedLaneKeys
1688+
? Array.from(claimOptions.blockedLaneKeys)
1689+
: [];
1690+
const candidateIds = claimOptions?.candidateIds
1691+
? Array.from(claimOptions.candidateIds)
1692+
: [];
1693+
if (
1694+
candidateIds.includes("0000000000000043") &&
1695+
blockedLaneKeys.length > 0 &&
1696+
!blockedSecondClaim
1697+
) {
16871698
blockedSecondClaim = true;
16881699
resolve();
16891700
await gate;
16901701
}
1691-
return queue.claim(...args);
1702+
return queue.claimNext(...args);
16921703
},
16931704
};
16941705
},

0 commit comments

Comments
 (0)