Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: Do not apply usage limit tracking on dedicated servers #2405

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions press/press/doctype/site/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
from press.press.doctype.server.server import is_dedicated_server
from press.press.doctype.site_activity.site_activity import log_site_activity
from press.press.doctype.site_analytics.site_analytics import create_site_analytics
from press.press.doctype.site_plan.site_plan import get_plan_config
from press.press.doctype.site_plan.site_plan import UNLIMITED_PLANS, get_plan_config
from press.press.report.mariadb_slow_queries.mariadb_slow_queries import (
get_doctype_name,
)
Expand Down Expand Up @@ -2124,7 +2124,12 @@
return plan

def get_plan_config(self, plan=None):
return get_plan_config(self.get_plan_name(plan))
plan = self.get_plan_name(plan)
config = get_plan_config(plan)
if plan in UNLIMITED_PLANS:
# PERF: do not enable usage tracking on unlimited sites.
config.pop("rate_limit", None)

Check warning on line 2131 in press/press/doctype/site/site.py

View check run for this annotation

Codecov / codecov/patch

press/press/doctype/site/site.py#L2131

Added line #L2131 was not covered by tests
return config

def set_latest_bench(self):
from pypika.terms import PseudoColumn
Expand Down
2 changes: 2 additions & 0 deletions press/press/doctype/site_plan/site_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

from press.press.doctype.site_plan.plan import Plan

UNLIMITED_PLANS = ["Unlimited", "Unlimited - Supported"]


class SitePlan(Plan):
# begin: auto-generated types
Expand Down
Loading