summaryrefslogtreecommitdiffstats
path: root/app/ratelimit.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2018-04-27 14:12:01 -0700
committerChristopher Speller <crspeller@gmail.com>2018-04-27 14:12:01 -0700
commiteb9ff34fcfa51cd8205841a02f3d3d61ec5be8fa (patch)
treeed01fd9488bd86f6c2daf0b299dff5beb43973db /app/ratelimit.go
parent2386acb3ddabd8827e21b1862c338a8b13a25de6 (diff)
parent2e6b3da1d3466db379fef0d61a23e2878d17ee9d (diff)
downloadchat-eb9ff34fcfa51cd8205841a02f3d3d61ec5be8fa.tar.gz
chat-eb9ff34fcfa51cd8205841a02f3d3d61ec5be8fa.tar.bz2
chat-eb9ff34fcfa51cd8205841a02f3d3d61ec5be8fa.zip
Merge branch 'master' into advanced-permissions-phase-2
Diffstat (limited to 'app/ratelimit.go')
-rw-r--r--app/ratelimit.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/ratelimit.go b/app/ratelimit.go
index 13508f36f..77d15caa2 100644
--- a/app/ratelimit.go
+++ b/app/ratelimit.go
@@ -4,12 +4,13 @@
package app
import (
+ "fmt"
"math"
"net/http"
"strconv"
"strings"
- l4g "github.com/alecthomas/log4go"
+ "github.com/mattermost/mattermost-server/mlog"
"github.com/mattermost/mattermost-server/model"
"github.com/mattermost/mattermost-server/utils"
"github.com/pkg/errors"
@@ -74,14 +75,14 @@ func (rl *RateLimiter) GenerateKey(r *http.Request) string {
func (rl *RateLimiter) RateLimitWriter(key string, w http.ResponseWriter) bool {
limited, context, err := rl.throttledRateLimiter.RateLimit(key, 1)
if err != nil {
- l4g.Critical("Internal server error when rate limiting. Rate Limiting broken. Error:" + err.Error())
+ mlog.Critical("Internal server error when rate limiting. Rate Limiting broken. Error:" + err.Error())
return false
}
setRateLimitHeaders(w, context)
if limited {
- l4g.Error("Denied due to throttling settings code=429 key=%v", key)
+ mlog.Error(fmt.Sprintf("Denied due to throttling settings code=429 key=%v", key))
http.Error(w, "limit exceeded", 429)
}