Skip to content

Commit

Permalink
fix: too many connections in router transform (#4492)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sidddddarth authored Mar 18, 2024
1 parent f4185e2 commit 3da9179
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions router/transformer/transformer.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,27 @@ func (trans *handle) Transform(transformType string, transformMessage *types.Tra
if err != nil {
trans.transformRequestTimerStat.SendTiming(time.Since(s))
reqFailed = true
trans.logger.Errorf("JS HTTP connection error: URL: %v Error: %+v", url, err)
trans.logger.Errorn(
"JS HTTP connection error",
logger.NewErrorField(err),
logger.NewStringField("URL", url),
)
if retryCount > config.GetInt("Processor.maxRetry", 30) {
panic(fmt.Errorf("JS HTTP connection error: URL: %v Error: %+v", url, err))
}
retryCount++
time.Sleep(config.GetDurationVar(100, time.Millisecond, "Processor.retrySleep", "Processor.retrySleepInMS"))
// Refresh the connection
httputil.CloseResponse(resp)
continue
}

if reqFailed {
trans.logger.Errorf("Failed request succeeded after %v retries, URL: %v", retryCount, url)
trans.logger.Errorn(
"Failed request succeeded",
logger.NewStringField("URL", url),
logger.NewIntField("RetryCount", int64(retryCount)),
)
}

trans.transformRequestTimerStat.SendTiming(time.Since(s))
Expand Down

0 comments on commit 3da9179

Please sign in to comment.