Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scaler fails only when failing to get counts from all the interceptor endpoints #903

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This changelog keeps track of work items that have been completed and are ready
- [v0.5.0](#v050)

## Unreleased
Scaler fails only when failing to get counts from all the interceptor endpoints.

### Breaking Changes
- **General**: TODO ([#TODO](https://github.com/kedacore/http-add-on/issues/TODO))
Expand Down
5 changes: 4 additions & 1 deletion pkg/queue/queue_rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ func GetCounts(
interceptorURL.Path = countsPath
resp, err := httpCl.Get(interceptorURL.String())
if err != nil {
return nil, fmt.Errorf("requesting the queue counts from %s: %w", interceptorURL.String(), err)
m := &Counts{
Counts: map[string]int{"all failed": 0},
}
return m, nil
}
defer resp.Body.Close()
counts := NewCounts()
Expand Down
6 changes: 6 additions & 0 deletions scaler/queue_pinger.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,5 +254,11 @@ func fetchCounts(
}
}

// if fetch all failed, throw error
// if any fetch succeeded, return counts from them
if _, found := totalCounts["all failed"]; found && len(totalCounts) == 1 {
return nil, 0, fmt.Errorf("fetching all counts failed, cannot reach any of the endpoints")
}

return totalCounts, agg, nil
}
Loading