mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-11-17 00:07:49 +00:00
open offer manager completes shut down after thread pool
This commit is contained in:
parent
902accb290
commit
fabec9d396
1 changed files with 9 additions and 9 deletions
|
@ -331,20 +331,20 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
||||||
// Force broadcaster to send out immediately, otherwise we could have a 2 sec delay until the
|
// Force broadcaster to send out immediately, otherwise we could have a 2 sec delay until the
|
||||||
// bundled messages sent out.
|
// bundled messages sent out.
|
||||||
broadcaster.flush();
|
broadcaster.flush();
|
||||||
|
// For typical number of offers we are tolerant with delay to give enough time to broadcast.
|
||||||
if (completeHandler != null) {
|
// If number of offers is very high we limit to 3 sec. to not delay other shutdown routines.
|
||||||
// For typical number of offers we are tolerant with delay to give enough time to broadcast.
|
long delayMs = Math.min(3000, size * 200 + 500);
|
||||||
// If number of offers is very high we limit to 3 sec. to not delay other shutdown routines.
|
GenUtils.waitFor(delayMs);;
|
||||||
int delay = Math.min(3000, size * 200 + 500);
|
|
||||||
UserThread.runAfter(completeHandler, delay, TimeUnit.MILLISECONDS);
|
|
||||||
}
|
|
||||||
}, THREAD_ID);
|
}, THREAD_ID);
|
||||||
} else {
|
} else {
|
||||||
broadcaster.flush();
|
broadcaster.flush();
|
||||||
if (completeHandler != null)
|
|
||||||
completeHandler.run();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// shut down thread pool
|
||||||
shutDownThreadPool();
|
shutDownThreadPool();
|
||||||
|
|
||||||
|
// invoke completion handler
|
||||||
|
if (completeHandler != null) completeHandler.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void shutDownThreadPool() {
|
private void shutDownThreadPool() {
|
||||||
|
|
Loading…
Reference in a new issue