Skip to content

Commit 8a5aa40

Browse files
committed
change the default sticky client ttl
1 parent 5843811 commit 8a5aa40

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/packages/conat/core/sticky.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const SUBJECT = "sticky.one";
3737

3838
const DEFAULT_CHOICE_TTL = 60_000 * 60 * 24 * 30; // 30 days
3939

40-
const DEFAULT_CLIENT_TTL = 15_000; // 15 seconds
40+
const DEFAULT_CLIENT_TTL = 120_000; // 2 minutes
4141

4242
// NOTE: there are no assumptions here about clocks being synchronized. These
4343
// are just ttl's.
@@ -79,8 +79,10 @@ export async function createStickyRouter({
7979
// The client trusts a choice returned from the router for this long,
8080
// or until the target is no longer available. Thus if the target
8181
// is randomly vanishing and coming back and a reassignment gets made,
82-
// this client would definitely find out if necessary within this amount of time.
83-
// Basically this is roughly how long failover may take.
82+
// this client would definitely find out if necessary within this amount
83+
// of time. Basically this is roughly how long failover may take in the
84+
// worst imaginable situation (which is unlikely in practice). Making this
85+
// longer greatly reduces server load and increases scalability.
8486
clientTtl = DEFAULT_CLIENT_TTL,
8587
}: {
8688
client: Client;

0 commit comments

Comments
 (0)