Skip to content

Commit

Permalink
Merge pull request #269 from airbrake/bug-fix
Browse files Browse the repository at this point in the history
refactor status and label select statement
  • Loading branch information
chimanjain authored May 2, 2022
2 parents 8ee2a8f + 66c1247 commit 34b2d09
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
3 changes: 1 addition & 2 deletions notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const userAgent = notifierName + "/" + notifierVersion
const waitTimeout = 5 * time.Second

const httpEnhanceYourCalm = 420
const httpStatusTooManyRequests = 429

const maxNoticeLen = 64 * 1024

Expand Down Expand Up @@ -355,7 +354,7 @@ func (n *Notifier) sendNotice(notice *Notice) (string, error) {
switch resp.StatusCode {
case http.StatusUnauthorized:
return "", errUnauthorized
case httpStatusTooManyRequests:
case http.StatusTooManyRequests:
delayStr := resp.Header.Get("X-RateLimit-Delay")
delay, err := strconv.ParseInt(delayStr, 10, 64)
if err == nil {
Expand Down
2 changes: 1 addition & 1 deletion queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (s *queryStats) send(m map[queryKey]*tdigestStat) error {
switch resp.StatusCode {
case http.StatusUnauthorized:
return errUnauthorized
case httpStatusTooManyRequests:
case http.StatusTooManyRequests:
return errIPRateLimited
}

Expand Down
2 changes: 1 addition & 1 deletion queues.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (s *queueStats) send(m map[queueKey]*queueBreakdown) error {
switch resp.StatusCode {
case http.StatusUnauthorized:
return errUnauthorized
case httpStatusTooManyRequests:
case http.StatusTooManyRequests:
return errIPRateLimited
}

Expand Down
3 changes: 2 additions & 1 deletion remote_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func (rc *remoteConfig) Poll() {
rc.ticker = time.NewTicker(rc.Interval())

for {
sel:
select {
case <-rc.ticker.C:
if err := rc.tick(); err != nil {
Expand All @@ -87,7 +88,7 @@ func (rc *remoteConfig) Poll() {

rc.ticker = time.NewTicker(rc.Interval())
case <-rc.pollStop:
break
break sel
}
}
}()
Expand Down
2 changes: 1 addition & 1 deletion routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func (s *routeStats) send(m map[routeKey]*tdigestStat) error {
switch resp.StatusCode {
case http.StatusUnauthorized:
return errUnauthorized
case httpStatusTooManyRequests:
case http.StatusTooManyRequests:
return errIPRateLimited
}

Expand Down

0 comments on commit 34b2d09

Please sign in to comment.