Skip to content

Conversation

adityaprayas
Copy link

Connection timeout for gnmi connection for user to connect


// Parse optional parameters
for _, option := range options {
switch v := option.(type) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we checking based on the type ?

DefaultBackoffMaxDelay int = 60
DefaultBackoffDelayFactor float64 = 3
DefaultGnmiTimeout time.Duration = 15 * time.Second // Configurable gNMI timeout
DefaultConnectTimeout time.Duration = 30 * time.Second // Configurable connection timeout
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain what the issue you try to slove and why we have two timeout ?

cancel() // Clean up timeout context immediately

if err != nil {
c.Devices[device].SetMutex.Unlock()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The device unlock is already handled in the following lines.

c.Devices[device].SetMutex.Lock()
if !c.ReuseConnection {
err = target.CreateGNMIClient(ctx)
// Create connection context with configurable timeout
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why we’re adding two timeouts for the same gNMI call—check line 195.

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

Successfully merging this pull request may close these issues.

3 participants