From 27c2f3d837b1e42ffea0845d1e165849ce482e5f Mon Sep 17 00:00:00 2001 From: Beto Dealmeida Date: Thu, 1 Jun 2023 15:57:36 -0700 Subject: [PATCH] chore: rate limit requests --- superset/config.py | 6 ++++++ superset/models/dashboard.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/superset/config.py b/superset/config.py index 4a7434093c9b1..02c2458d9e38e 100644 --- a/superset/config.py +++ b/superset/config.py @@ -265,6 +265,12 @@ def _try_json_readsha(filepath: str, length: int) -> str | None: # Configuration for scheduling queries from SQL Lab. SCHEDULED_QUERIES: dict[str, Any] = {} +# Rate limiting +RATELIMIT_ENABLED = True +AUTH_RATE_LIMITED = True +AUTH_RATE_LIMIT = "2 per 5 second" +RATELIMIT_APPLICATION = "50 per second" + # ------------------------------ # GLOBALS FOR APP Builder # ------------------------------ diff --git a/superset/models/dashboard.py b/superset/models/dashboard.py index e6b91a60d333e..39d25c1972304 100644 --- a/superset/models/dashboard.py +++ b/superset/models/dashboard.py @@ -377,7 +377,7 @@ def export_dashboards( # pylint: disable=too-many-locals ) -> str: copied_dashboards = [] datasource_ids = set() - for dashboard_id in dashboard_ids: + for dashboard_id in set(dashboard_ids): # make sure that dashboard_id is an integer dashboard_id = int(dashboard_id) dashboard = (