reduce trade concurrency to 4 in GitHub Actions

This commit is contained in:
woodser 2024-04-08 07:27:03 -04:00
parent b304139779
commit 28a47e1aba

View file

@ -143,11 +143,10 @@ const defaultTradeConfig: Partial<TradeContext> = {
disputeSummary: "Seller is winner", disputeSummary: "Seller is winner",
walletSyncPeriodMs: 5000, walletSyncPeriodMs: 5000,
maxTimePeerNoticeMs: 5000, maxTimePeerNoticeMs: 5000,
maxConcurrency: 14, // max concurrency
maxConcurrencyCI: 7, // CI test max concurrency
stopOnFailure: true, stopOnFailure: true,
testPayoutConfirmed: true, testPayoutConfirmed: true,
testPayoutUnlocked: false testPayoutUnlocked: false,
maxConcurrency: getMaxConcurrency()
} }
/** /**
@ -217,8 +216,6 @@ class TradeContext {
isPayoutUnlocked?: boolean isPayoutUnlocked?: boolean
buyerOpenedDispute?: boolean; buyerOpenedDispute?: boolean;
sellerOpenedDispute?: boolean; sellerOpenedDispute?: boolean;
maxConcurrency?: number;
maxConcurrencyCI?: number;
walletSyncPeriodMs: number; walletSyncPeriodMs: number;
maxTimePeerNoticeMs: number; maxTimePeerNoticeMs: number;
stopOnFailure?: boolean; stopOnFailure?: boolean;
@ -230,6 +227,7 @@ class TradeContext {
payoutTxId?: string payoutTxId?: string
testBalanceChangeEndToEnd?: boolean; testBalanceChangeEndToEnd?: boolean;
isStopped: boolean; isStopped: boolean;
maxConcurrency: number;
constructor(ctx?: Partial<TradeContext>) { constructor(ctx?: Partial<TradeContext>) {
Object.assign(this, ctx); Object.assign(this, ctx);
@ -1647,7 +1645,7 @@ test("Can complete trades at the same time (CI, sanity check)", async () => {
} }
// execute trades with capped concurrency for CI tests // execute trades with capped concurrency for CI tests
await executeTrades(ctxs, {maxConcurrency: TestConfig.trade.maxConcurrencyCI}); await executeTrades(ctxs);
}); });
test("Can complete all trade combinations (stress)", async () => { test("Can complete all trade combinations (stress)", async () => {
@ -3874,6 +3872,14 @@ function testMoneroNodeSettingsEqual(settingsBefore: XmrNodeSettings, settingsAf
expect(settingsAfter.getStartupFlagsList()).toEqual(settingsBefore.getStartupFlagsList()); expect(settingsAfter.getStartupFlagsList()).toEqual(settingsBefore.getStartupFlagsList());
} }
function getMaxConcurrency() {
return isGitHubActions() ? 4 : 14;
}
function isGitHubActions() {
return process.env.GITHUB_ACTIONS === 'true';
}
function getFormField(form: PaymentAccountForm, fieldId: PaymentAccountFormField.FieldId): PaymentAccountFormField { function getFormField(form: PaymentAccountForm, fieldId: PaymentAccountFormField.FieldId): PaymentAccountFormField {
for (const field of form.getFieldsList()) { for (const field of form.getFieldsList()) {
if (field.getId() == fieldId) return field; if (field.getId() == fieldId) return field;