bisq-network / bisq-pricenode

GNU General Public License v3.0
5 stars 12 forks source link

Stale prices supplied after exchange provider API fails. #18

Closed ghost closed 1 year ago

ghost commented 1 year ago

Production bug encountered: XMR price became divergent from the exchange rate supplier prices. All pricenodes were consistent between themselves, but divergent from reality, e.g. real price was 0.0057, bisq price 0.00558

It was tracked down to one exchange API (Poloniex) which had started returning error 403:forbidden.

However, the cached rates from Poloniex were still being provided internally in the Pricenode, therefore dragging down the Bisq average price.

Pricenode should not keep returning stale prices when a provider API fails.


The code was written with the intention that if the provider fails, no prices should be provided. That makes sense. Now, why in this case are previous Poloniex prices sticking around? Its because in this particular case the exception happens too early, outside of a try..catch block, it is not being handled in doGet() so the exception propagates higher meaning results never reach the PriceProvider which keeps its previous values (until the Poloniex API is restored, or the PriceNode is rebooted).

I am working on a fix.