Skip to content

Commit 8ae4811

Browse files
authored
perf: Don't recompute subway status on the homepage on every page load (#3286)
1 parent 015fb58 commit 8ae4811

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

lib/dotcom_web/controllers/page_controller.ex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ defmodule DotcomWeb.PageController do
2121
@type content :: Banner.t() | Teaser.t() | WhatsHappeningItem.t()
2222
@type whats_happening_set :: {nil | [WhatsHappeningItem.t()], nil | [WhatsHappeningItem.t()]}
2323

24+
@subway_status_cache Application.compile_env!(:dotcom, :system_status_cache_modules)[:subway]
25+
2426
def index(conn, _params) do
2527
{promoted, remainder} = whats_happening_items()
2628
banner = banner()
@@ -137,6 +139,6 @@ defmodule DotcomWeb.PageController do
137139
defp do_add_utm_url(item, url), do: %{item | utm_url: url}
138140

139141
defp subway_status(conn, _opts) do
140-
assign(conn, :subway_status, Dotcom.SystemStatus.subway_status())
142+
assign(conn, :subway_status, @subway_status_cache.subway_status())
141143
end
142144
end

0 commit comments

Comments
 (0)