Skip to content

Commit

Permalink
Merge pull request #716 from luraproject/fix_log
Browse files Browse the repository at this point in the history
fix log messages
  • Loading branch information
kpacha authored Mar 7, 2024
2 parents f836a87 + 7c82285 commit 54ecfd5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions proxy/concurrent.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package proxy
import (
"context"
"errors"
"fmt"
"time"

"github.com/luraproject/lura/v2/config"
Expand All @@ -14,16 +15,16 @@ import (
// NewConcurrentMiddlewareWithLogger creates a proxy middleware that enables sending several requests concurrently
func NewConcurrentMiddlewareWithLogger(logger logging.Logger, remote *config.Backend) Middleware {
if remote.ConcurrentCalls == 1 {
logger.Fatal("too few concurrent calls for %s %s -> %s: NewConcurrentMiddleware expects more than 1 concurrent call, got %d",
remote.ParentEndpointMethod, remote.ParentEndpoint, remote.URLPattern, remote.ConcurrentCalls)
logger.Fatal(fmt.Sprintf("too few concurrent calls for %s %s -> %s: NewConcurrentMiddleware expects more than 1 concurrent call, got %d",
remote.ParentEndpointMethod, remote.ParentEndpoint, remote.URLPattern, remote.ConcurrentCalls))
return nil
}
serviceTimeout := time.Duration(75*remote.Timeout.Nanoseconds()/100) * time.Nanosecond

return func(next ...Proxy) Proxy {
if len(next) > 1 {
logger.Fatal("too many proxies for this %s -> %s proxy middleware: NewConcurrentMiddleware only accepts 1 proxy, got %d",
remote.ParentEndpointMethod, remote.ParentEndpoint, remote.URLPattern, len(next))
logger.Fatal(fmt.Sprintf("too many proxies for this %s %s -> %s proxy middleware: NewConcurrentMiddleware only accepts 1 proxy, got %d",
remote.ParentEndpointMethod, remote.ParentEndpoint, remote.URLPattern, len(next)))
return nil
}

Expand Down

0 comments on commit 54ecfd5

Please sign in to comment.