mirror of
https://github.com/boldsuck/haveno.git
synced 2024-12-31 21:29:22 +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(() -> {
|
||||
// we need to check if in the meantime the offer has been removed
|
||||
if (openOffers.contains(openOffer) && openOffer.isAvailable())
|
||||
refreshOffer(openOffer);
|
||||
refreshOffer(openOffer, 0, 1);
|
||||
}, minDelay, maxDelay, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
} else {
|
||||
|
@ -1801,10 +1801,15 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
|||
log.trace("periodicRefreshOffersTimer already stated");
|
||||
}
|
||||
|
||||
private void refreshOffer(OpenOffer openOffer) {
|
||||
private void refreshOffer(OpenOffer openOffer, int numAttempts, int maxAttempts) {
|
||||
offerBookService.refreshTTL(openOffer.getOffer().getOfferPayload(),
|
||||
() -> 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() {
|
||||
|
|
Loading…
Reference in a new issue