Skip to content

Commit 99e60c6

Browse files
committed
Do not reconnect on scrapligo transport errors
1 parent 193e16e commit 99e60c6

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

client.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,23 +1296,25 @@ func isScrapliogoErrorTransient(err error) bool {
12961296

12971297
// hasTransportError checks if errors indicate transport/connection issues
12981298
//
1299-
// Checks both NETCONF <rpc-error> elements with ErrorType="transport" and
1300-
// scrapligo Go errors (timeout, connection, operation errors).
1299+
// Checks NETCONF <rpc-error> elements with ErrorType="transport".
13011300
//
13021301
// Transport errors require session reconnection before retry to ensure a
13031302
// clean connection state.
13041303
//
1305-
// Returns true if transport/connection errors are detected.
1306-
func (c *Client) hasTransportError(errs []ErrorModel, goErr error) bool {
1304+
// Note: Scrapligo Go errors (timeout, connection, operation) are treated as
1305+
// transient for retry purposes but do NOT trigger reconnection. The existing
1306+
// connection will be reused for retries.
1307+
//
1308+
// Returns true if transport errors are detected.
1309+
func (c *Client) hasTransportError(errs []ErrorModel) bool {
13071310
// Check NETCONF rpc-error elements for transport type
13081311
for _, rpcErr := range errs {
13091312
if rpcErr.ErrorType == transportErrType {
13101313
return true
13111314
}
13121315
}
13131316

1314-
// Check scrapligo Go errors for timeout/connection issues
1315-
return isScrapliogoErrorTransient(goErr)
1317+
return false
13161318
}
13171319

13181320
// Backoff calculates the backoff delay for retry attempt using exponential backoff with jitter
@@ -1520,8 +1522,8 @@ func (c *Client) sendRPC(ctx context.Context, req *Req) (Res, error) {
15201522
}
15211523

15221524
// Check for transport/connection errors that require reconnection
1523-
// This includes both NETCONF <rpc-error> transport errors and scrapligo Go errors
1524-
hasTransportError := c.hasTransportError(res.Errors, err)
1525+
// Only NETCONF <rpc-error> transport errors trigger reconnection
1526+
hasTransportError := c.hasTransportError(res.Errors)
15251527

15261528
// Not transient or max retries reached
15271529
if !isTransient || attempt >= c.MaxRetries {

0 commit comments

Comments
 (0)