Skip to content

Commit

Permalink
fix: dashboard api cache decorator (#21964)
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgaspar authored and eschutho committed Nov 2, 2022
1 parent 70b0a96 commit 5773195
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions superset/dashboards/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,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 @@ -281,8 +283,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
@event_logger.log_this_with_context(
Expand Down Expand Up @@ -325,6 +325,8 @@ def get(self, dash: Dashboard) -> Response:
result = self.dashboard_get_response_schema.dump(dash)
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 @@ -335,8 +337,6 @@ def get(self, dash: Dashboard) -> Response:
),
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 @@ -388,6 +388,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 @@ -398,8 +400,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

0 comments on commit 5773195

Please sign in to comment.