Skip to content

Commit

Permalink
fix limiter
Browse files Browse the repository at this point in the history
  • Loading branch information
crflynn committed Feb 4, 2022
1 parent fb98bca commit 70a10f9
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fi

if [[ "$1" = "web" ]]
then
exec poetry run gunicorn -b 0.0.0.0:5000 -w 2 --access-logfile - --error-log - --access-logformat "%({x-forwarded-for}i)s %(h)s %(l)s %(u)s %(t)s \"%(r)s\" %(s)s %(b)s \"%(f)s\" \"%(a)s\"" pypistats.run:app
exec poetry run gunicorn -b 0.0.0.0:5000 -w 2 --access-logfile - --error-log - --access-logformat "%({x-forwarded-for}i)s %(l)s %(h)s %(l)s %(u)s %(t)s \"%(r)s\" %(s)s %(b)s \"%(f)s\" \"%(a)s\"" pypistats.run:app
fi

if [[ "$1" = "celery" ]]
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/flower.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
spec:
containers:
- name: pypistats-flower
image: us.gcr.io/pypistats-org/pypistats:10
image: us.gcr.io/pypistats-org/pypistats:11
imagePullPolicy: Always
args: ["flower"]
envFrom:
Expand Down
4 changes: 2 additions & 2 deletions kubernetes/tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ spec:
spec:
containers:
- name: beat
image: us.gcr.io/pypistats-org/pypistats:10
image: us.gcr.io/pypistats-org/pypistats:11
imagePullPolicy: Always
args: ["beat"]
envFrom:
- secretRef:
name: pypistats-secrets
- name: celery
image: us.gcr.io/pypistats-org/pypistats:10
image: us.gcr.io/pypistats-org/pypistats:11
imagePullPolicy: Always
args: ["celery"]
envFrom:
Expand Down
4 changes: 2 additions & 2 deletions kubernetes/web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ spec:
spec:
initContainers:
- name: migrate
image: us.gcr.io/pypistats-org/pypistats:10
image: us.gcr.io/pypistats-org/pypistats:11
imagePullPolicy: Always
envFrom:
- secretRef:
name: pypistats-secrets
args: ["migrate"]
containers:
- name: web
image: us.gcr.io/pypistats-org/pypistats:10
image: us.gcr.io/pypistats-org/pypistats:11
imagePullPolicy: Always
envFrom:
- secretRef:
Expand Down
2 changes: 1 addition & 1 deletion pypistats/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
app = create_app(configs[env])

# Rate limiting per IP/worker
app.wsgi_app = ProxyFix(app.wsgi_app)
app.wsgi_app = ProxyFix(app.wsgi_app, x_for=2)
limiter = Limiter(app, key_func=get_remote_address, application_limits=["5 per second", "30 per minute"])

app.logger.info(f"Environment: {env}")
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pypistatsorg"
version = "10"
version = "11"
description = "Download counts dashboard for python packages"
authors = ["Flynn <[email protected]>"]

Expand Down

0 comments on commit 70a10f9

Please sign in to comment.