mirror of
https://github.com/netbirdio/netbird.git
synced 2026-07-16 11:39:57 +00:00
sleep on global limiter
This commit is contained in:
@@ -458,6 +458,8 @@ func (s *GRPCServer) Login(ctx context.Context, req *proto.EncryptedMessage) (*p
|
||||
if !ok {
|
||||
// Check global limiter before allowing a new peer limiter
|
||||
if !s.loginLimiter.Allow() {
|
||||
time.Sleep(time.Second + (time.Millisecond * time.Duration(rand.IntN(20)*100)))
|
||||
log.WithContext(ctx).Warnf("rate limit exceeded for peer %s", req.WgPubKey)
|
||||
return nil, fmt.Errorf("temp rate limit reached (global limit)")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user