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

[Access] Heartbeat interval not reset correctly in streaming endpoints #6837

Open
peterargue opened this issue Dec 24, 2024 · 1 comment · May be fixed by #6848
Open

[Access] Heartbeat interval not reset correctly in streaming endpoints #6837

peterargue opened this issue Dec 24, 2024 · 1 comment · May be fixed by #6848
Assignees
Labels
Bug Something isn't working S-Access

Comments

@peterargue
Copy link
Contributor

The response tracking logic in the streaming endpoints does not reset the blocksSinceLastMessage variable when messages are sent. This could result in unnecessary heartbeat messages getting sent. This is fairly benign, but we may as well fix it.

For example:

// check if there are any events in the response. if not, do not send a message unless the last
// response was more than HeartbeatInterval blocks ago
if len(resp.Events) == 0 {
blocksSinceLastMessage++
if blocksSinceLastMessage < heartbeatInterval {
return nil
}
blocksSinceLastMessage = 0
}

This should be

if len(resp.Events) == 0 {
	blocksSinceLastMessage++
	if blocksSinceLastMessage < heartbeatInterval {
		return nil
	}
}
blocksSinceLastMessage = 0

This ensures that blocksSinceLastMessage is reset whenever a response is sent.

@Guitarheroua
Copy link
Contributor

Will duplicate my comment here. If changes from this issue will be backported to v0.37, the flow-sdk should be definitely checked for issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working S-Access
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants