Skip to content

Commit

Permalink
controller_http: use strings.Contains to match a EOF response
Browse files Browse the repository at this point in the history
The error comparison with errors.Is does not work here,
because the EOF error has been stringified within the client request message.
  • Loading branch information
joelrebel committed Aug 23, 2024
1 parent 78de3bb commit 180e7c5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions controller_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package ctrl
import (
"context"
"fmt"
"io"
"net/http"
"net/url"
"runtime/debug"
"strings"
"time"

"github.com/google/uuid"
Expand Down Expand Up @@ -432,7 +432,7 @@ func (n *HTTPController) fetchTaskWithRetries(ctx context.Context, serverID uuid
func (n *HTTPController) fetchCondition(ctx context.Context, serverID uuid.UUID) (*condition.Condition, error) {
resp, err := n.orcQueryor.ConditionQuery(ctx, serverID)
if err != nil {
if errors.Is(err, io.EOF) {
if strings.Contains(err.Error(), "EOF") {
return nil, errors.Wrap(errRetryRequest, "unexpected empty response")
}

Expand Down Expand Up @@ -461,7 +461,7 @@ func (n *HTTPController) fetchCondition(ctx context.Context, serverID uuid.UUID)
func (n *HTTPController) fetchTask(ctx context.Context, serverID uuid.UUID) (*condition.Task[any, any], error) {
resp, err := n.orcQueryor.ConditionTaskQuery(ctx, n.conditionKind, serverID)
if err != nil {
if errors.Is(err, io.EOF) {
if strings.Contains(err.Error(), "EOF") {
return nil, errors.Wrap(errRetryRequest, "unexpected empty response")
}

Expand Down

0 comments on commit 180e7c5

Please sign in to comment.