Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve the duplication issue in the seq cache #4390

Merged
merged 1 commit into from
Jun 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export const storeFastPathData = async (bid: Bid, _requestContext: RequestContex
status = execStatus.status as ExecStatus;
}
}
if (status === ExecStatus.None || status === ExecStatus.Dequeued) {
if (status === ExecStatus.None) {
const message: Message = {
transferId: transfer.transferId,
originDomain: transfer.xparams!.originDomain,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
ExecutorDataSchema,
ExecStatus,
jsonifyError,
getNtpTimeSeconds,
} from "@connext/nxtp-utils";

import { getContext, SlippageErrorPatterns } from "../../../sequencer";
Expand Down Expand Up @@ -58,10 +59,27 @@ export const storeSlowPathData = async (executorData: ExecutorData, _requestCont
await cache.transfers.storeTransfers([transfer]);

// Ensure that the executor data for this transfer hasn't expired.
const status = await cache.executors.getExecStatus(transferId);
let status = await cache.executors.getExecStatus(transferId);
if (status != ExecStatus.None) {
const lastExecTime = await cache.executors.getExecStatusTime(transferId);
const elapsed = (getNtpTimeSeconds() - lastExecTime) * 1000;
if (elapsed > config.executionWaitTime) {
logger.info("Executor merits retry", requestContext, methodContext, { transferId: transferId, status });
// Publish this transferId to sequencer subscriber to retry execution
status = ExecStatus.None;
await cache.executors.setExecStatus(transferId, status);
} else {
logger.info("Transfer awaiting execution", requestContext, methodContext, {
elapsed,
waitTime: config.executionWaitTime,
status,
});
}
}

if (status === ExecStatus.Completed) {
throw new ExecuteSlowCompleted({ transferId });
} else if (status === ExecStatus.None || status === ExecStatus.Dequeued) {
} else if (status === ExecStatus.None) {
const message: Message = {
transferId: transfer.transferId,
originDomain: transfer.xparams!.originDomain,
Expand Down