Skip to content
This repository has been archived by the owner on Sep 6, 2018. It is now read-only.

Retry delayedRemoveEntryFromMailbox #20

Merged
merged 5 commits into from Aug 29, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/main/java/bisq/network/p2p/P2PService.java
Expand Up @@ -740,7 +740,17 @@ public void removeEntryFromMailbox(DecryptedMessageWithPubKey decryptedMessageWi
// at the P2PService layer.
// Though we have to check in the client classes to not apply the same message again as there is no guarantee
// when we would get a message again from the network.
UserThread.runAfter(() -> delayedRemoveEntryFromMailbox(decryptedMessageWithPubKey), 2);
try {
UserThread.runAfter(() -> delayedRemoveEntryFromMailbox(decryptedMessageWithPubKey), 2);
} catch (NetworkNotReadyException t) {
// If we called too early it might throw a NetworkNotReadyException. We will try again
try {
UserThread.runAfter(() -> delayedRemoveEntryFromMailbox(decryptedMessageWithPubKey), 60);
} catch (NetworkNotReadyException ignore) {
log.warn("We tried to call delayedRemoveEntryFromMailbox 60 sec. after we received an " +
"NetworkNotReadyException but it failed again. We give up here.");
}
}
}

private void delayedRemoveEntryFromMailbox(DecryptedMessageWithPubKey decryptedMessageWithPubKey) {
Expand Down