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

fix: dashboard api cache decorator #21964

Merged
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
12 changes: 6 additions & 6 deletions superset/dashboards/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ def __repr__(self) -> str:
self.appbuilder.app.config["VERSION_SHA"],
)

@expose("/<id_or_slug>", methods=["GET"])
@protect()
@etag_cache(
get_last_modified=lambda _self, id_or_slug: DashboardDAO.get_dashboard_changed_on( # pylint: disable=line-too-long,useless-suppression
id_or_slug
Expand All @@ -286,8 +288,6 @@ def __repr__(self) -> str:
),
skip=lambda _self, id_or_slug: not is_feature_enabled("DASHBOARD_CACHE"),
)
@expose("/<id_or_slug>", methods=["GET"])
@protect()
@safe
@statsd_metrics
@with_dashboard
Expand Down Expand Up @@ -334,6 +334,8 @@ def get(
)
return self.response(200, result=result)

@expose("/<id_or_slug>/datasets", methods=["GET"])
@protect()
@etag_cache(
get_last_modified=lambda _self, id_or_slug: DashboardDAO.get_dashboard_and_datasets_changed_on( # pylint: disable=line-too-long,useless-suppression
id_or_slug
Expand All @@ -344,8 +346,6 @@ def get(
),
skip=lambda _self, id_or_slug: not is_feature_enabled("DASHBOARD_CACHE"),
)
@expose("/<id_or_slug>/datasets", methods=["GET"])
@protect()
@safe
@statsd_metrics
@event_logger.log_this_with_context(
Expand Down Expand Up @@ -403,6 +403,8 @@ def get_datasets(self, id_or_slug: str) -> Response:
except DashboardNotFoundError:
return self.response_404()

@expose("/<id_or_slug>/charts", methods=["GET"])
@protect()
@etag_cache(
get_last_modified=lambda _self, id_or_slug: DashboardDAO.get_dashboard_and_slices_changed_on( # pylint: disable=line-too-long,useless-suppression
id_or_slug
Expand All @@ -413,8 +415,6 @@ def get_datasets(self, id_or_slug: str) -> Response:
),
skip=lambda _self, id_or_slug: not is_feature_enabled("DASHBOARD_CACHE"),
)
@expose("/<id_or_slug>/charts", methods=["GET"])
@protect()
@safe
@statsd_metrics
@event_logger.log_this_with_context(
Expand Down