Skip to content

Commit

Permalink
x-pack/filebeat/input/cel: avoid a negative request rate (#40270)
Browse files Browse the repository at this point in the history
This is the minimal change necessary to fix the following problem.

Around the time of a rate limit reset, if current time is after the
reset time returned in response headers, the rate limiting code will
set a negative target rate, and if that's done at a time when no
request budget has accumulated, it will not recover and will wait
forever.
  • Loading branch information
efd6 authored Jul 24, 2024
1 parent c75f9bc commit de8c76d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Fix for Google Workspace duplicate events issue by adding canonical sorting over fingerprint keys array to maintain key order. {pull}40055[40055] {issue}39859[39859]
- Fix handling of deeply nested numeric values in HTTP Endpoint CEL programs. {pull}40115[40115]
- Prevent panic in CEL and salesforce inputs when github.com/hashicorp/go-retryablehttp exceeds maximum retries. {pull}40144[40144]
- Fix bug in CEL input rate limit logic. {issue}40106[40106] {pull}40270[40270]

*Heartbeat*

Expand Down
2 changes: 1 addition & 1 deletion x-pack/filebeat/input/cel/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ func handleRateLimit(log *logp.Logger, rateLimit map[string]interface{}, header
}

// Process reset if we need to wait until reset to avoid a request against a zero quota.
if limit == 0 {
if limit <= 0 {
w, ok := rateLimit["reset"]
if ok {
switch w := w.(type) {
Expand Down

0 comments on commit de8c76d

Please sign in to comment.