Skip to content

Commit c4642ee

Browse files
committed
Retry on scrapligo transport errors
1 parent 3d2464e commit c4642ee

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

client.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package netconf
66
import (
77
"context"
88
"crypto/rand"
9+
"errors"
910
"fmt"
1011
"math"
1112
"math/big"
@@ -1397,9 +1398,18 @@ func (c *Client) sendRPC(ctx context.Context, req *Req) (Res, error) {
13971398
return res, nil
13981399
}
13991400

1400-
// Check if transient
1401+
// Check if transient (check both NETCONF errors and Go errors)
14011402
isTransient := c.checkTransientError(res.Errors)
14021403

1404+
// Also check for scrapligo transient errors (timeout, connection errors)
1405+
if err != nil {
1406+
if errors.Is(err, util.ErrTimeoutError) ||
1407+
errors.Is(err, util.ErrConnectionError) ||
1408+
errors.Is(err, util.ErrOperationError) {
1409+
isTransient = true
1410+
}
1411+
}
1412+
14031413
// Handle lock-denied errors with polling before general backoff
14041414
if isTransient {
14051415
// Check if this is a lock-denied error

0 commit comments

Comments
 (0)