Skip to content

HTTP Client custom retry function whether this situation will be abnormal #920

@bubble66

Description

@bubble66

Describe the Question

The http Client custom retry function will have an exception when canIdempotentRetry is false?
Reproducible Code

image

Expected behavior

	if canIdempotentRetry && client.DefaultRetryIf(req, resp, err) && errors.Is(err, errs.ErrBadPoolConn) {
		connAttempts++
		continue
	}

	if isDefaultRetryFunc {
		break
	}

	attempts++
	if attempts >= maxAttempts {
		break
	}

	// Check whether this request should be retried
	if canIdempotentRetry && !isRequestRetryable(req, resp, err) {
		break
	}

Would it be better to write like this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions