Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle "unavailable" schema module status more correctly #266

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/absinthe/plug.ex
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,16 @@ defmodule Absinthe.Plug do
schema
end

defp valid_schema_module?(module) do
defp valid_schema_module?(module, retries \\ 0) do
with true <- is_atom(module),
{:module, _} <- Code.ensure_compiled(module),
true <- Absinthe.Schema in Keyword.get(module.__info__(:attributes), :behaviour, []) do
true
else
{:error, :unavailable} when retries < 100 ->
Process.sleep(100)
valid_schema_module?(module, retries + 1)

_ -> false
end
end
Expand Down