remove trade lock while shutting down trade thread

This commit is contained in:
woodser 2025-04-08 09:19:40 -04:00 committed by woodser
parent 7243d7fa38
commit ad38e3b80c
3 changed files with 33 additions and 33 deletions

View file

@ -1607,13 +1607,11 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model {
}
// shut down trade threads
synchronized (getLock()) {
isInitialized = false;
isShutDown = true;
List<Runnable> shutDownThreads = new ArrayList<>();
shutDownThreads.add(() -> ThreadUtils.shutDown(getId()));
ThreadUtils.awaitTasks(shutDownThreads);
}
// save and close
if (wallet != null) {
@ -2513,7 +2511,7 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model {
try {
syncWallet(pollWallet);
} catch (Exception e) {
if (!isShutDown && walletExists()) {
if (!isShutDownStarted && walletExists()) {
log.warn("Error syncing trade wallet for {} {}: {}", getClass().getSimpleName(), getId(), e.getMessage());
}
}

View file

@ -110,8 +110,10 @@ public abstract class XmrWalletBase {
try {
height = wallet.getHeight(); // can get read timeout while syncing
} catch (Exception e) {
if (wallet != null && !isShutDownStarted) {
log.warn("Error getting wallet height while syncing with progress: " + e.getMessage());
if (wallet != null && !isShutDownStarted) log.warn(ExceptionUtils.getStackTrace(e));
log.warn(ExceptionUtils.getStackTrace(e));
}
// stop polling and release latch
syncProgressError = e;