mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-01-03 09:29:44 +00:00
repeat refresh offer on TTL error
This commit is contained in:
parent
203386f03d
commit
5d7991e4f7
1 changed files with 8 additions and 3 deletions
|
@ -1788,7 +1788,7 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
||||||
UserThread.runAfterRandomDelay(() -> {
|
UserThread.runAfterRandomDelay(() -> {
|
||||||
// we need to check if in the meantime the offer has been removed
|
// we need to check if in the meantime the offer has been removed
|
||||||
if (openOffers.contains(openOffer) && openOffer.isAvailable())
|
if (openOffers.contains(openOffer) && openOffer.isAvailable())
|
||||||
refreshOffer(openOffer);
|
refreshOffer(openOffer, 0, 1);
|
||||||
}, minDelay, maxDelay, TimeUnit.MILLISECONDS);
|
}, minDelay, maxDelay, TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1801,10 +1801,15 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
||||||
log.trace("periodicRefreshOffersTimer already stated");
|
log.trace("periodicRefreshOffersTimer already stated");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshOffer(OpenOffer openOffer) {
|
private void refreshOffer(OpenOffer openOffer, int numAttempts, int maxAttempts) {
|
||||||
offerBookService.refreshTTL(openOffer.getOffer().getOfferPayload(),
|
offerBookService.refreshTTL(openOffer.getOffer().getOfferPayload(),
|
||||||
() -> log.debug("Successful refreshed TTL for offer"),
|
() -> log.debug("Successful refreshed TTL for offer"),
|
||||||
log::warn);
|
(errorMessage) -> {
|
||||||
|
log.warn(errorMessage);
|
||||||
|
if (numAttempts + 1 < maxAttempts) {
|
||||||
|
UserThread.runAfter(() -> refreshOffer(openOffer, numAttempts + 1, maxAttempts), 10);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void restart() {
|
private void restart() {
|
||||||
|
|
Loading…
Reference in a new issue