Open
Conversation
sokosam
reviewed
Dec 2, 2025
| can0Active := h.can0 != nil | ||
| can1Active := h.can1 != nil | ||
| return can0Active, can1Active | ||
| } |
Contributor
There was a problem hiding this comment.
I haven't touched go in a while but can you confirm if this actually checks if the can channels are active? (assuming that this is the goal)
are we certain that if HeartbeatHandler -> can0 : net.Conn is simply initialized that it would mean its active/online?
Again I'm not really sure how this works so just lmk if its right or not.
| logger.Error("Failed to send heartbeat", zap.Error(err)) | ||
| } | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
Can we name both to Interval? Feels weird to have one be uploadTimer and heartbeatInterval
Suggested change
| } | |
| uploadInterval := time.NewTimer(time.Second) | |
| heartbeatInterval := time.NewTicker(3 * time.Second) | |
| defer heartbeatInterval.Stop() | |
| for { | |
| select { | |
| case <-uploadInterval.C: | |
| err = telemetry.Upload() | |
| if err != nil { | |
| fmt.Printf("failed to upload telemetry data: %v\n", err) | |
| } | |
| case <-heartbeatInterval.C: | |
| err = heartbeat.SendHeartbeat() | |
| if err != nil { | |
| logger.Error("Failed to send heartbeat", zap.Error(err)) | |
| } | |
| } | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Completed basic heartbeat functionality for DAQ with the following features and design considerations:
Decided to implement heartbeat on separate heartbeat.go file for modularization.
On an interval, currently 3s, send POST request to the server with the following info:
If communication fails, nothing happens; we will continue sending on the same regular interval.