increase trade protocol step timeout to 2m

This commit is contained in:
woodser 2024-04-13 09:04:23 -04:00
parent 2ba37d98fe
commit ccf2757418
9 changed files with 22 additions and 22 deletions

View File

@ -133,7 +133,7 @@ public class PlaceOfferProtocol {
stopTimeoutTimer(); stopTimeoutTimer();
timeoutTimer = UserThread.runAfter(() -> { timeoutTimer = UserThread.runAfter(() -> {
handleError(Res.get("createOffer.timeoutAtPublishing")); handleError(Res.get("createOffer.timeoutAtPublishing"));
}, TradeProtocol.TRADE_TIMEOUT); }, TradeProtocol.TRADE_TIMEOUT_SECONDS);
} }
private void stopTimeoutTimer() { private void stopTimeoutTimer() {

View File

@ -59,13 +59,13 @@ public class ArbitratorProtocol extends DisputeProtocol {
ArbitratorSendInitTradeOrMultisigRequests.class) ArbitratorSendInitTradeOrMultisigRequests.class)
.using(new TradeTaskRunner(trade, .using(new TradeTaskRunner(trade,
() -> { () -> {
startTimeout(TRADE_TIMEOUT); startTimeout(TRADE_TIMEOUT_SECONDS);
handleTaskRunnerSuccess(peer, message); handleTaskRunnerSuccess(peer, message);
}, },
errorMessage -> { errorMessage -> {
handleTaskRunnerFault(peer, message, errorMessage); handleTaskRunnerFault(peer, message, errorMessage);
})) }))
.withTimeout(TRADE_TIMEOUT)) .withTimeout(TRADE_TIMEOUT_SECONDS))
.executeTasks(true); .executeTasks(true);
awaitTradeLatch(); awaitTradeLatch();
} }
@ -100,7 +100,7 @@ public class ArbitratorProtocol extends DisputeProtocol {
errorMessage -> { errorMessage -> {
handleTaskRunnerFault(sender, request, errorMessage); handleTaskRunnerFault(sender, request, errorMessage);
})) }))
.withTimeout(TRADE_TIMEOUT)) .withTimeout(TRADE_TIMEOUT_SECONDS))
.executeTasks(true); .executeTasks(true);
awaitTradeLatch(); awaitTradeLatch();
} }

View File

@ -74,13 +74,13 @@ public class BuyerAsMakerProtocol extends BuyerProtocol implements MakerProtocol
MakerSendInitTradeRequest.class) MakerSendInitTradeRequest.class)
.using(new TradeTaskRunner(trade, .using(new TradeTaskRunner(trade,
() -> { () -> {
startTimeout(TRADE_TIMEOUT); startTimeout(TRADE_TIMEOUT_SECONDS);
handleTaskRunnerSuccess(peer, message); handleTaskRunnerSuccess(peer, message);
}, },
errorMessage -> { errorMessage -> {
handleTaskRunnerFault(peer, message, errorMessage); handleTaskRunnerFault(peer, message, errorMessage);
})) }))
.withTimeout(TRADE_TIMEOUT)) .withTimeout(TRADE_TIMEOUT_SECONDS))
.executeTasks(true); .executeTasks(true);
awaitTradeLatch(); awaitTradeLatch();
} }

View File

@ -79,13 +79,13 @@ public class BuyerAsTakerProtocol extends BuyerProtocol implements TakerProtocol
TakerSendInitTradeRequestToArbitrator.class) TakerSendInitTradeRequestToArbitrator.class)
.using(new TradeTaskRunner(trade, .using(new TradeTaskRunner(trade,
() -> { () -> {
startTimeout(TRADE_TIMEOUT); startTimeout(TRADE_TIMEOUT_SECONDS);
unlatchTrade(); unlatchTrade();
}, },
errorMessage -> { errorMessage -> {
handleError(errorMessage); handleError(errorMessage);
})) }))
.withTimeout(TRADE_TIMEOUT)) .withTimeout(TRADE_TIMEOUT_SECONDS))
.executeTasks(true); .executeTasks(true);
awaitTradeLatch(); awaitTradeLatch();
} }

View File

@ -79,13 +79,13 @@ public class SellerAsMakerProtocol extends SellerProtocol implements MakerProtoc
MakerSendInitTradeRequest.class) MakerSendInitTradeRequest.class)
.using(new TradeTaskRunner(trade, .using(new TradeTaskRunner(trade,
() -> { () -> {
startTimeout(TRADE_TIMEOUT); startTimeout(TRADE_TIMEOUT_SECONDS);
handleTaskRunnerSuccess(peer, message); handleTaskRunnerSuccess(peer, message);
}, },
errorMessage -> { errorMessage -> {
handleTaskRunnerFault(peer, message, errorMessage); handleTaskRunnerFault(peer, message, errorMessage);
})) }))
.withTimeout(TRADE_TIMEOUT)) .withTimeout(TRADE_TIMEOUT_SECONDS))
.executeTasks(true); .executeTasks(true);
awaitTradeLatch(); awaitTradeLatch();
} }

View File

@ -80,13 +80,13 @@ public class SellerAsTakerProtocol extends SellerProtocol implements TakerProtoc
TakerSendInitTradeRequestToArbitrator.class) TakerSendInitTradeRequestToArbitrator.class)
.using(new TradeTaskRunner(trade, .using(new TradeTaskRunner(trade,
() -> { () -> {
startTimeout(TRADE_TIMEOUT); startTimeout(TRADE_TIMEOUT_SECONDS);
unlatchTrade(); unlatchTrade();
}, },
errorMessage -> { errorMessage -> {
handleError(errorMessage); handleError(errorMessage);
})) }))
.withTimeout(TRADE_TIMEOUT)) .withTimeout(TRADE_TIMEOUT_SECONDS))
.executeTasks(true); .executeTasks(true);
awaitTradeLatch(); awaitTradeLatch();
} }

View File

@ -93,7 +93,7 @@ import java.util.concurrent.CountDownLatch;
@Slf4j @Slf4j
public abstract class TradeProtocol implements DecryptedDirectMessageListener, DecryptedMailboxListener { public abstract class TradeProtocol implements DecryptedDirectMessageListener, DecryptedMailboxListener {
public static final int TRADE_TIMEOUT = 60; public static final int TRADE_TIMEOUT_SECONDS = 120;
private static final String TIMEOUT_REACHED = "Timeout reached."; private static final String TIMEOUT_REACHED = "Timeout reached.";
protected final ProcessModel processModel; protected final ProcessModel processModel;
@ -316,13 +316,13 @@ public abstract class TradeProtocol implements DecryptedDirectMessageListener, D
MaybeSendSignContractRequest.class) MaybeSendSignContractRequest.class)
.using(new TradeTaskRunner(trade, .using(new TradeTaskRunner(trade,
() -> { () -> {
startTimeout(TRADE_TIMEOUT); startTimeout(TRADE_TIMEOUT_SECONDS);
handleTaskRunnerSuccess(sender, request); handleTaskRunnerSuccess(sender, request);
}, },
errorMessage -> { errorMessage -> {
handleTaskRunnerFault(sender, request, errorMessage); handleTaskRunnerFault(sender, request, errorMessage);
})) }))
.withTimeout(TRADE_TIMEOUT)) .withTimeout(TRADE_TIMEOUT_SECONDS))
.executeTasks(true); .executeTasks(true);
awaitTradeLatch(); awaitTradeLatch();
} }
@ -354,13 +354,13 @@ public abstract class TradeProtocol implements DecryptedDirectMessageListener, D
ProcessSignContractRequest.class) ProcessSignContractRequest.class)
.using(new TradeTaskRunner(trade, .using(new TradeTaskRunner(trade,
() -> { () -> {
startTimeout(TRADE_TIMEOUT); startTimeout(TRADE_TIMEOUT_SECONDS);
handleTaskRunnerSuccess(sender, message); handleTaskRunnerSuccess(sender, message);
}, },
errorMessage -> { errorMessage -> {
handleTaskRunnerFault(sender, message, errorMessage); handleTaskRunnerFault(sender, message, errorMessage);
})) }))
.withTimeout(TRADE_TIMEOUT)) // extend timeout .withTimeout(TRADE_TIMEOUT_SECONDS)) // extend timeout
.executeTasks(true); .executeTasks(true);
awaitTradeLatch(); awaitTradeLatch();
} else { } else {
@ -399,13 +399,13 @@ public abstract class TradeProtocol implements DecryptedDirectMessageListener, D
ProcessSignContractResponse.class) ProcessSignContractResponse.class)
.using(new TradeTaskRunner(trade, .using(new TradeTaskRunner(trade,
() -> { () -> {
startTimeout(TRADE_TIMEOUT); startTimeout(TRADE_TIMEOUT_SECONDS);
handleTaskRunnerSuccess(sender, message); handleTaskRunnerSuccess(sender, message);
}, },
errorMessage -> { errorMessage -> {
handleTaskRunnerFault(sender, message, errorMessage); handleTaskRunnerFault(sender, message, errorMessage);
})) }))
.withTimeout(TRADE_TIMEOUT)) // extend timeout .withTimeout(TRADE_TIMEOUT_SECONDS)) // extend timeout
.executeTasks(true); .executeTasks(true);
awaitTradeLatch(); awaitTradeLatch();
} else { } else {
@ -451,7 +451,7 @@ public abstract class TradeProtocol implements DecryptedDirectMessageListener, D
errorMessage -> { errorMessage -> {
handleTaskRunnerFault(sender, response, errorMessage); handleTaskRunnerFault(sender, response, errorMessage);
})) }))
.withTimeout(TRADE_TIMEOUT)) .withTimeout(TRADE_TIMEOUT_SECONDS))
.executeTasks(true); .executeTasks(true);
awaitTradeLatch(); awaitTradeLatch();
} }

View File

@ -92,7 +92,7 @@ public class MaybeSendSignContractRequest extends TradeTask {
} }
// reset protocol timeout // reset protocol timeout
trade.getProtocol().startTimeout(TradeProtocol.TRADE_TIMEOUT); trade.getProtocol().startTimeout(TradeProtocol.TRADE_TIMEOUT_SECONDS);
// collect reserved key images // collect reserved key images
List<String> reservedKeyImages = new ArrayList<String>(); List<String> reservedKeyImages = new ArrayList<String>();

View File

@ -59,7 +59,7 @@ public class TakerReserveTradeFunds extends TradeTask {
for (MoneroOutput input : reserveTx.getInputs()) reservedKeyImages.add(input.getKeyImage().getHex()); for (MoneroOutput input : reserveTx.getInputs()) reservedKeyImages.add(input.getKeyImage().getHex());
// reset protocol timeout // reset protocol timeout
trade.getProtocol().startTimeout(TradeProtocol.TRADE_TIMEOUT); trade.getProtocol().startTimeout(TradeProtocol.TRADE_TIMEOUT_SECONDS);
// save process state // save process state
processModel.setReserveTx(reserveTx); processModel.setReserveTx(reserveTx);