You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I am configuring 100 rate per 60 seconds with a python plugin.
When I am using a single gateway pod everything is working fine. but when we scale up number of pods we are seeing that
for first 60 seconds we are getting 200
but after that, rate never gets reset. We are constantly getting 429s
My middleware is like this
from tyk.decorators import *
from gateway import TykGateway as tyk
from policies import policy
import datetime
import os
import sys
parent_dir = os.path.abspath(os.path.dirname(__file__))
vendor_dir = os.path.join(parent_dir, 'vendor')
sys.path.append(vendor_dir)
@Hook
def MyAuthMiddleware(request, session, metadata, spec):
tyk.log("Starting Auth middleware", "info")
default_policy = policy["voyages"]["default"]
try:
tyk.log(f"request ip is {request.get_header('X-Real-Ip')}", "info")
if str(request.get_header('X-Real-Ip')) != '':
metadata["token"] = request.get_header('X-Real-Ip')
session.rate = default_policy["rate"]
session.per = default_policy["per"]
session.quota_max = default_policy["quota_max"]
session.quota_renewal_rate = default_policy["quota_renewal_rate"]
session.session_lifetime = 3600
except:
tyk.log("something went wrong", "info")
return request, session, metadata
Reproduction steps
Steps to reproduce the behavior:
Scale tyk gateway pods to 2
Deploy the plugin to do rate limiting with ip
Actual behavior
API keeps on returning 429 even after the rate limit interval (60 seconds) has passed Expected behavior
Rate limit for a particular ip should get reset after 60 seconds
Additional context
Tyk version: CE (v5.2.3)
The text was updated successfully, but these errors were encountered:
andyo-tyk
changed the title
Rate limit does not get reset when using more than 1 gateway pods in kubernetes
[TT-13402] Rate limit does not get reset when using more than 1 gateway pods in kubernetes
Oct 25, 2024
Branch/Environment/Version
Describe the bug
I am configuring 100 rate per 60 seconds with a python plugin.
When I am using a single gateway pod everything is working fine. but when we scale up number of pods we are seeing that
for first 60 seconds we are getting 200
but after that, rate never gets reset. We are constantly getting 429s
My middleware is like this
Reproduction steps
Steps to reproduce the behavior:
Actual behavior
API keeps on returning 429 even after the rate limit interval (60 seconds) has passed
Expected behavior
Rate limit for a particular ip should get reset after 60 seconds
Additional context
Tyk version: CE (v5.2.3)
The text was updated successfully, but these errors were encountered: