Skip to content

Commit

Permalink
Make more timeouts configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
singpolyma committed Jan 8, 2025
1 parent d940c9c commit c08cab8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/stream-management/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ export default function streamManagement({
inbound: 0,
max: null,
timeout: 60_000,
requestAckInterval: 300_000,
debounceAckRequest: 100,
_teardown: () => {
clearTimeout(timeoutTimeout);
clearTimeout(requestAckTimeout);
Expand Down Expand Up @@ -173,7 +175,7 @@ export default function streamManagement({
entity.send(xml("r", { xmlns: NS })).catch(() => {});
// Periodically send r to check the connection
// If a stanza goes out it will cancel this and set a sooner timer
requestAckTimeout = setTimeout(requestAck, 300_000);
requestAckTimeout = setTimeout(requestAck, sm.requestAckInterval);
}

middleware.filter((context, next) => {
Expand All @@ -184,7 +186,7 @@ export default function streamManagement({
sm.outbound_q.push({ stanza, stamp: datetime() });
// Debounce requests so we send only one after a big run of stanza together
clearTimeout(requestAckTimeout);
requestAckTimeout = setTimeout(requestAck, 100);
requestAckTimeout = setTimeout(requestAck, sm.debounceAckRequest);
return next();
});

Expand Down

0 comments on commit c08cab8

Please sign in to comment.