Skip to content

Commit

Permalink
properly set the heartbeat interval for a target defined subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
karimra committed Jan 20, 2025
1 parent 90be036 commit 378fb7c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion pkg/config/subscriptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,19 @@ func (c *Config) subscriptionOpts(sc *types.SubscriptionConfig, tc *types.Target
subGnmiOpts = append(subGnmiOpts, api.HeartbeatInterval(*sc.HeartbeatInterval))
}
subGnmiOpts = append(subGnmiOpts, api.SubscriptionMode(sc.StreamMode))
case gnmi.SubscriptionMode_SAMPLE, gnmi.SubscriptionMode_TARGET_DEFINED:
case gnmi.SubscriptionMode_TARGET_DEFINED:
if sc.HeartbeatInterval != nil {
subGnmiOpts = append(subGnmiOpts, api.HeartbeatInterval(*sc.HeartbeatInterval))
}
if sc.SampleInterval != nil {
subGnmiOpts = append(subGnmiOpts, api.SampleInterval(*sc.SampleInterval))
}
subGnmiOpts = append(subGnmiOpts, api.SuppressRedundant(sc.SuppressRedundant))
if sc.SuppressRedundant && sc.HeartbeatInterval != nil {
subGnmiOpts = append(subGnmiOpts, api.HeartbeatInterval(*sc.HeartbeatInterval))
}
subGnmiOpts = append(subGnmiOpts, api.SubscriptionMode(sc.StreamMode))
case gnmi.SubscriptionMode_SAMPLE:
if sc.SampleInterval != nil {
subGnmiOpts = append(subGnmiOpts, api.SampleInterval(*sc.SampleInterval))
}
Expand Down

0 comments on commit 378fb7c

Please sign in to comment.