Log exchange rate warning only once

This commit is contained in:
Lee Clagett 2021-04-19 00:49:14 -04:00
parent b3af4e90c8
commit faa51780f3

View file

@ -132,6 +132,11 @@ namespace lws
return {std::make_pair(user->second, std::move(*reader))};
}
namespace
{
std::atomic_flag rates_error_once = ATOMIC_FLAG_INIT;
}
struct get_address_info
{
using request = rpc::account_credentials;
@ -198,7 +203,7 @@ namespace lws
}
resp.rates = client.get_rates();
if (!resp.rates)
if (!resp.rates && !rates_error_once.test_and_set(std::memory_order_relaxed))
MWARNING("Unable to retrieve exchange rates: " << resp.rates.error().message());
return resp;