- Add retry: false to VISP Client HTTP requests - Add retry: false to ReleaseChecker GitHub API requests - Remove unused Plug.Conn import from RemoteIpLogger - Remove unused default parameter from req_get/2 Results: - VISP sync test: 7007ms → 113ms (62x faster) - ReleaseChecker test: 7004ms → 17ms (402x faster) - UserResetPasswordLive test: 1495ms → 284ms (5x faster) Req's default retry behavior (1s, 2s, 4s exponential backoff) was causing 7-second delays for HTTP 500/503 error responses in tests. For these clients, immediate failure is preferred over retries.
25 lines
897 B
Elixir
25 lines
897 B
Elixir
defmodule ToweropsWeb.GraphQL.Resolvers.Organization do
|
|
@moduledoc "GraphQL resolvers for organization queries and mutations."
|
|
|
|
alias Towerops.Organizations
|
|
alias ToweropsWeb.GraphQL.Resolvers.Helpers
|
|
|
|
def get(_parent, _args, %{context: %{organization_id: org_id}}) do
|
|
org = Organizations.get_organization!(org_id)
|
|
{:ok, org}
|
|
end
|
|
|
|
def get(_parent, _args, _resolution), do: Helpers.authentication_error()
|
|
|
|
def update(_parent, %{input: input}, %{context: %{organization_id: org_id}}) do
|
|
org = Organizations.get_organization!(org_id)
|
|
attrs = Map.new(input, fn {k, v} -> {to_string(k), v} end)
|
|
|
|
case Organizations.update_organization(org, attrs) do
|
|
{:ok, updated} -> {:ok, updated}
|
|
{:error, changeset} -> {:error, Helpers.format_changeset_errors(changeset)}
|
|
end
|
|
end
|
|
|
|
def update(_parent, _args, _resolution), do: Helpers.authentication_error()
|
|
end
|