mirror of
https://github.com/boldsuck/haveno.git
synced 2024-12-23 04:29:22 +00:00
shut down open offer pool off ui thread to avoid blocking
This commit is contained in:
parent
eaf096adeb
commit
23db847065
1 changed files with 8 additions and 6 deletions
|
@ -351,17 +351,19 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
||||||
// For typical number of offers we are tolerant with delay to give enough time to broadcast.
|
// For typical number of offers we are tolerant with delay to give enough time to broadcast.
|
||||||
// If number of offers is very high we limit to 3 sec. to not delay other shutdown routines.
|
// If number of offers is very high we limit to 3 sec. to not delay other shutdown routines.
|
||||||
long delayMs = Math.min(3000, size * 200 + 500);
|
long delayMs = Math.min(3000, size * 200 + 500);
|
||||||
GenUtils.waitFor(delayMs);;
|
GenUtils.waitFor(delayMs);
|
||||||
}, THREAD_ID);
|
}, THREAD_ID);
|
||||||
} else {
|
} else {
|
||||||
broadcaster.flush();
|
broadcaster.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
// shut down thread pool
|
// shut down thread pool off main thread
|
||||||
|
ThreadUtils.submitToPool(() -> {
|
||||||
shutDownThreadPool();
|
shutDownThreadPool();
|
||||||
|
|
||||||
// invoke completion handler
|
// invoke completion handler
|
||||||
if (completeHandler != null) completeHandler.run();
|
if (completeHandler != null) completeHandler.run();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void shutDownThreadPool() {
|
private void shutDownThreadPool() {
|
||||||
|
|
Loading…
Reference in a new issue