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:
parent
a7ad608051
commit
b5756d8e00
1 changed files with 3 additions and 4 deletions
|
|
@ -98,13 +98,12 @@ defmodule Mv.Vereinfacht.Client do
|
||||||
|
|
||||||
@sync_timeout_ms 5_000
|
@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).
|
# 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
|
defp req_http_options do
|
||||||
opts = [receive_timeout: @sync_timeout_ms]
|
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
|
end
|
||||||
|
|
||||||
defp post_and_parse_contact(url, body, api_key) do
|
defp post_and_parse_contact(url, body, api_key) do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue