Created
June 14, 2020 00:26
-
-
Save krainboltgreene/8203e3c96c72e7b05b568104441f0f77 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def unload_cache_attempt({:ignore, :retry}, resource, parameters, http_client, cache) do | |
Logger.warn("Retrying request in 1s") | |
Process.sleep(1000) | |
fetch_for(resource, parameters, http_client, cache) | |
end | |
def unload_cache_attempt({:ok, %{status_code: 502}}, resource, parameters, http_client, cache) do | |
Logger.warn("Retrying request in 1s") | |
Process.sleep(1000) | |
fetch_for(resource, parameters, http_client, cache) | |
end | |
def unload_cache_attempt({:commit, value}, _resource, _parameters, _http_client, _cache) do | |
value | |
end | |
def unload_cache_attempt({:ok, value}, _resource, _parameters, _http_client, _cache) do | |
value | |
end | |
def unload_cache_attempt({:error, message}, _resource, _parameters, _http_client, _cache) do | |
Logger.error(message) | |
{:error, message} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment