exchange_rate: more robust spot price against temporary network issues
We poll the fx rate provider every 2.5 minutes (unchanged). Previously if there was any error during a tick, there was no fx rate available in the client until the next tick. Now, instead, we keep the last rates received with a 10 minute expiry. One potential drawback is that previously there was instant feedback to the user when e.g. changing proxy settings, and this is no longer the case. E.g. consider a provider that bans Tor exit nodes. If a user enables using a Tor proxy in the network settings, the fxrate used to disappear immediately - but now the cached rate would still be available.
This commit is contained in:
@@ -89,7 +89,8 @@ class TestWalletStorage(WalletTestCase):
|
||||
class FakeExchange(ExchangeBase):
|
||||
def __init__(self, rate):
|
||||
super().__init__(lambda self: None, lambda self: None)
|
||||
self.quotes = {'TEST': rate}
|
||||
self._quotes = {'TEST': rate}
|
||||
self._quotes_timestamp = float("inf") # spot price from the far future never becomes stale :P
|
||||
|
||||
class FakeFxThread:
|
||||
def __init__(self, exchange):
|
||||
|
||||
Reference in New Issue
Block a user