Skip to content

Commit

Permalink
Add verifications of the registry cache ets table
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmj committed Dec 12, 2024
1 parent eec7a26 commit 5c6151a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/hex/registry/server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ defmodule Hex.Registry.Server do
end

defp open_ets(path) do
case :ets.file2tab(path) do
case :ets.file2tab(path, verify: true) do
{:ok, tid} ->
tid

Expand Down Expand Up @@ -268,7 +268,12 @@ defmodule Hex.Registry.Server do
defp persist(tid, path) do
dir = Path.dirname(path)
File.mkdir_p!(dir)
:ok = :ets.tab2file(tid, String.to_charlist(path))

:ok =
:ets.tab2file(tid, String.to_charlist(path),
extended_info: [:object_count, :md5sum],
sync: true
)
end

defp purge_repo_from_cache(packages, %{ets: ets}) do
Expand Down

0 comments on commit 5c6151a

Please sign in to comment.