(s *scope, statusCode int, userCache *cache.AsyncCache, key *cache.Key, q []byte, failReason string, )
| 583 | var clickhouseRecoverableStatusCodes = map[int]struct{}{http.StatusServiceUnavailable: {}, http.StatusRequestTimeout: {}} |
| 584 | |
| 585 | func (rp *reverseProxy) completeTransaction(s *scope, statusCode int, userCache *cache.AsyncCache, key *cache.Key, |
| 586 | q []byte, |
| 587 | failReason string, |
| 588 | ) { |
| 589 | // complete successful transactions or those with empty fail reason |
| 590 | if statusCode < 300 || failReason == "" { |
| 591 | if err := userCache.Complete(key); err != nil { |
| 592 | log.Errorf("%s: %s; query: %q", s, err, q) |
| 593 | } |
| 594 | return |
| 595 | } |
| 596 | |
| 597 | if _, ok := clickhouseRecoverableStatusCodes[statusCode]; ok { |
| 598 | if err := userCache.Complete(key); err != nil { |
| 599 | log.Errorf("%s: %s; query: %q", s, err, q) |
| 600 | } |
| 601 | } else { |
| 602 | if err := userCache.Fail(key, failReason); err != nil { |
| 603 | log.Errorf("%s: %s; query: %q", s, err, q) |
| 604 | } |
| 605 | } |
| 606 | } |
| 607 | |
| 608 | func calcQueryParamsHash(origParams url.Values) uint32 { |
| 609 | queryParams := make(map[string]string) |
no test coverage detected