Skip to content

Commit 1fce0df

Browse files
committedApr 25, 2025·
reduce heartbeat delay
1 parent 486c905 commit 1fce0df

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed
 

‎src/packages/sync/table/changefeed-nats2.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ import { delay } from "awaiting";
99

1010
const HEARTBEAT = 15000;
1111

12+
// this should be significantly shorter than HEARTBEAT.
13+
// if user closes browser and comes back, then this is the time they may have to wait
14+
// for their changefeeds to reconnect, since clock jumps forward...
15+
const HEARTBEAT_CHECK_DELAY = 3000;
16+
1217
export class NatsChangefeed extends EventEmitter {
1318
private account_id: string;
1419
private query;
@@ -106,7 +111,7 @@ export class NatsChangefeed extends EventEmitter {
106111
this.close();
107112
return;
108113
}
109-
await delay(HEARTBEAT / 2);
114+
await delay(HEARTBEAT_CHECK_DELAY);
110115
}
111116
};
112117

0 commit comments

Comments
 (0)
Please sign in to comment.