mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-12-25 23:39:26 -05:00
stop initializing trades on shutdown
This commit is contained in:
parent
7062fa9e79
commit
e20e23dbc5
@ -118,6 +118,7 @@ import monero.wallet.model.MoneroOutputQuery;
|
|||||||
public class TradeManager implements PersistedDataHost, DecryptedDirectMessageListener {
|
public class TradeManager implements PersistedDataHost, DecryptedDirectMessageListener {
|
||||||
private static final Logger log = LoggerFactory.getLogger(TradeManager.class);
|
private static final Logger log = LoggerFactory.getLogger(TradeManager.class);
|
||||||
|
|
||||||
|
private boolean isShutDown;
|
||||||
private final User user;
|
private final User user;
|
||||||
@Getter
|
@Getter
|
||||||
private final KeyRing keyRing;
|
private final KeyRing keyRing;
|
||||||
@ -271,6 +272,7 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void shutDown() {
|
public void shutDown() {
|
||||||
|
isShutDown = true;
|
||||||
|
|
||||||
// collect trades to shutdown
|
// collect trades to shutdown
|
||||||
Set<Trade> trades = new HashSet<Trade>();
|
Set<Trade> trades = new HashSet<Trade>();
|
||||||
@ -360,6 +362,7 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
|
|||||||
HavenoUtils.executeTasks(tasks, threadPoolSize);
|
HavenoUtils.executeTasks(tasks, threadPoolSize);
|
||||||
|
|
||||||
// reset any available address entries
|
// reset any available address entries
|
||||||
|
if (isShutDown) return;
|
||||||
xmrWalletService.getAddressEntriesForAvailableBalanceStream()
|
xmrWalletService.getAddressEntriesForAvailableBalanceStream()
|
||||||
.filter(addressEntry -> addressEntry.getOfferId() != null)
|
.filter(addressEntry -> addressEntry.getOfferId() != null)
|
||||||
.forEach(addressEntry -> {
|
.forEach(addressEntry -> {
|
||||||
@ -378,6 +381,7 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initPersistedTrade(Trade trade) {
|
private void initPersistedTrade(Trade trade) {
|
||||||
|
if (isShutDown) return;
|
||||||
initTradeAndProtocol(trade, getTradeProtocol(trade));
|
initTradeAndProtocol(trade, getTradeProtocol(trade));
|
||||||
requestPersistence();
|
requestPersistence();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user