Skip to content

Commit

Permalink
Expire static cache on upgrade (#5801)
Browse files Browse the repository at this point in the history
* Use put instead of put_new

* clear cache
  • Loading branch information
chrismccord committed May 3, 2024
1 parent ed19338 commit 17eed64
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/phoenix/config.ex
Expand Up @@ -20,8 +20,8 @@ defmodule Phoenix.Config do
@doc """
Puts a given key-value pair in config.
"""
def put_new(module, key, value) do
:ets.insert_new(module, {key, value})
def put(module, key, value) do
:ets.insert(module, {key, value})
end

@doc """
Expand Down Expand Up @@ -152,6 +152,7 @@ defmodule Phoenix.Config do
{:stop, :normal, :ok, {module, permanent}}

true ->
clear_cache(module)
{:reply, :ok, {module, permanent}}
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/phoenix/endpoint/supervisor.ex
Expand Up @@ -381,7 +381,7 @@ defmodule Phoenix.Endpoint.Supervisor do
end

defp warmup_static(endpoint, %{"latest" => latest, "digests" => digests}) do
Phoenix.Config.put_new(endpoint, :cache_static_manifest_latest, latest)
Phoenix.Config.put(endpoint, :cache_static_manifest_latest, latest)
with_vsn? = !endpoint.config(:cache_manifest_skip_vsn)

Enum.each(latest, fn {key, _} ->
Expand Down

0 comments on commit 17eed64

Please sign in to comment.