Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make my heartbeat #24

Open
stephen-dahl opened this issue Apr 25, 2024 · 2 comments
Open

make my heartbeat #24

stephen-dahl opened this issue Apr 25, 2024 · 2 comments

Comments

@stephen-dahl
Copy link

the readme says

on(event: 'heartbeat', listener: (lsn: string, timestamp: number, shouldRespond: boolean) => Promise<void> | void)
A heartbeat check signal has been received from the server. You may need to run service.acknowledge().

Do I need to handle this event?
Other than shouldRespond, when should I acknowledge or not?
What happens if I don't acknowledge a heartbeat?

@stephen-dahl
Copy link
Author

service.on("heartbeat", async (lsn, ts, shouldRespond) => {
  if(shouldRespond) await service.acknowledge(lsn);
});

@nick-allen
Copy link

nick-allen commented Sep 22, 2024

service.on("heartbeat", async (lsn, ts, shouldRespond) => {
  if(shouldRespond) await service.acknowledge(lsn);
});

Just spent several hours tracking down why I was getting connection terminated unexpectedly, and this manual acknowledge in the heartbeat handler wound up being the fix. The acknowledge options in service instantiation appear to be meaningless, and this is basically undocumented, would be great if this was in the basic setup docs if it's intentionally required and not a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants