Skip to content

Commit 6d61b6f

Browse files
authored
Preserve LastComputeSeqNum if 0 (#4775)
Only update LastComputeSeqNum if greater than 0, as zero can indicate either no messages processed yet or a connection that has just been established. This preserves the existing sequence number in those cases. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced node management with improved health monitoring and state persistence. - Added conditional logic to prevent overwriting sequence numbers with zero. - Improved handling of disconnected nodes to retain existing connection states. - **Bug Fixes** - Adjusted control flow and error handling for better robustness in node state updates. - **Documentation** - Added logging statements for improved visibility into state transitions and error conditions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 9135124 commit 6d61b6f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/orchestrator/nodes/manager.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,13 @@ func (n *nodesManager) resolveStartingOrchestratorSeqNum(
850850
// We should implement proper comparison logic to ensure sequence numbers only advance forward.
851851
func (n *nodesManager) updateSequenceNumbers(state *models.ConnectionState, orchestratorSeq, computeSeq uint64) {
852852
state.LastOrchestratorSeqNum = orchestratorSeq
853-
state.LastComputeSeqNum = computeSeq
853+
854+
// Only update LastComputeSeqNum if greater than 0, as zero can indicate
855+
// either no messages processed yet or a connection that has just been
856+
// established. This preserves the existing sequence number in those cases.
857+
if computeSeq > 0 {
858+
state.LastComputeSeqNum = computeSeq
859+
}
854860
}
855861

856862
// enrichState adds live tracking data to a node state.

0 commit comments

Comments
 (0)