refactor(vereinfacht): gate retry skipping on runtime sandbox flag

The compile-time Mix.env() comparison folded to an always-false literal under analysis. sql_sandbox?/0 reads runtime config (true only in test) and works in releases where Mix is unavailable, preserving the fast-fail-no-retry behavior in tests.
This commit is contained in:
Moritz 2026-06-02 12:23:04 +02:00
parent a7ad608051
commit b5756d8e00

View file

@ -98,13 +98,12 @@ defmodule Mv.Vereinfacht.Client do
@sync_timeout_ms 5_000
# Resolved at compile time so Mix is never called at runtime (Mix is not available in releases).
@env Mix.env()
# In test, skip retries so sync fails fast when no API is running (avoids log spam and long waits).
# `sql_sandbox?/0` reads runtime config (true only in test) and avoids calling Mix at runtime,
# which is unavailable in releases.
defp req_http_options do
opts = [receive_timeout: @sync_timeout_ms]
if @env == :test, do: [retry: false] ++ opts, else: opts
if Mv.Config.sql_sandbox?(), do: [retry: false] ++ opts, else: opts
end
defp post_and_parse_contact(url, body, api_key) do