Skip to content

Commit e937cc4

Browse files
GSMLG-BOTclaude
andcommitted
fix: resolve Credo compatibility issue and improve race condition handling
- Update Credo from ~1.5 to ~1.7 to fix regex compilation error with OTP 28 - Add robust error handling in Registry.lookup for concurrent ETS access - Handle cases where ETS table doesn't exist during concurrent operations - Ensure CI passes across all Elixir/OTP versions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 65f2ab9 commit e937cc4

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

lib/dns/message/record/data/registry.ex

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,19 @@ defmodule DNS.Message.Record.Data.Registry do
4141
# Ensure the registry is initialized
4242
ensure_registry_initialized()
4343

44-
case :ets.lookup(@type_table, type) do
45-
[{^type, module}] -> {:ok, module}
46-
[] -> {:error, :not_found}
44+
try do
45+
case :ets.lookup(@type_table, type) do
46+
[{^type, module}] -> {:ok, module}
47+
[] -> {:error, :not_found}
48+
end
49+
rescue
50+
ArgumentError ->
51+
# Table doesn't exist, try to initialize and retry once
52+
ensure_registry_initialized()
53+
case :ets.lookup(@type_table, type) do
54+
[{^type, module}] -> {:ok, module}
55+
[] -> {:error, :not_found}
56+
end
4757
end
4858
end
4959

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ defmodule DNS.MixProject do
3636
{:tesla, "~> 1.0", runtime: false},
3737
{:machete, ">= 0.0.0", only: [:dev, :test]},
3838
{:dialyxir, "~> 1.0", only: [:dev, :test], runtime: false},
39-
{:credo, "~> 1.5", only: [:dev, :test], runtime: false},
39+
{:credo, "~> 1.7", only: [:dev, :test], runtime: false},
4040
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false}
4141
]
4242
end

0 commit comments

Comments
 (0)