From 23db8470650b2c8eda2680ba87fbc4873306854b Mon Sep 17 00:00:00 2001 From: woodser Date: Mon, 19 Feb 2024 12:31:26 -0500 Subject: [PATCH] shut down open offer pool off ui thread to avoid blocking --- .../java/haveno/core/offer/OpenOfferManager.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/haveno/core/offer/OpenOfferManager.java b/core/src/main/java/haveno/core/offer/OpenOfferManager.java index 29591935..2c70814d 100644 --- a/core/src/main/java/haveno/core/offer/OpenOfferManager.java +++ b/core/src/main/java/haveno/core/offer/OpenOfferManager.java @@ -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. // 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); - GenUtils.waitFor(delayMs);; + GenUtils.waitFor(delayMs); }, THREAD_ID); } else { broadcaster.flush(); } - // shut down thread pool - shutDownThreadPool(); - - // invoke completion handler - if (completeHandler != null) completeHandler.run(); + // shut down thread pool off main thread + ThreadUtils.submitToPool(() -> { + shutDownThreadPool(); + + // invoke completion handler + if (completeHandler != null) completeHandler.run(); + }); } private void shutDownThreadPool() {