remove activeLongPoll on error and prevent activeLongPoll skip if forced
This commit is contained in:
parent
0b2bf13def
commit
767f1a9d67
@ -982,7 +982,9 @@ enum BankStatusResultCode {
|
|||||||
export async function processWithdrawalGroup(
|
export async function processWithdrawalGroup(
|
||||||
ws: InternalWalletState,
|
ws: InternalWalletState,
|
||||||
withdrawalGroupId: string,
|
withdrawalGroupId: string,
|
||||||
options: object = {},
|
options: {
|
||||||
|
forceNow?: boolean;
|
||||||
|
} = {},
|
||||||
): Promise<OperationAttemptResult> {
|
): Promise<OperationAttemptResult> {
|
||||||
logger.trace("processing withdrawal group", withdrawalGroupId);
|
logger.trace("processing withdrawal group", withdrawalGroupId);
|
||||||
const withdrawalGroup = await ws.db
|
const withdrawalGroup = await ws.db
|
||||||
@ -998,7 +1000,7 @@ export async function processWithdrawalGroup(
|
|||||||
const retryTag = RetryTags.forWithdrawal(withdrawalGroup);
|
const retryTag = RetryTags.forWithdrawal(withdrawalGroup);
|
||||||
|
|
||||||
// We're already running!
|
// We're already running!
|
||||||
if (ws.activeLongpoll[retryTag]) {
|
if (ws.activeLongpoll[retryTag] && !options.forceNow) {
|
||||||
logger.info("withdrawal group already in long-polling, returning!");
|
logger.info("withdrawal group already in long-polling, returning!");
|
||||||
return {
|
return {
|
||||||
type: OperationAttemptResultType.Longpoll,
|
type: OperationAttemptResultType.Longpoll,
|
||||||
@ -1035,8 +1037,9 @@ export async function processWithdrawalGroup(
|
|||||||
getErrorDetailFromException(e),
|
getErrorDetailFromException(e),
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
} finally {
|
||||||
delete ws.activeLongpoll[retryTag];
|
delete ws.activeLongpoll[retryTag];
|
||||||
|
}
|
||||||
if (!res.ready) {
|
if (!res.ready) {
|
||||||
await storeOperationPending(ws, retryTag);
|
await storeOperationPending(ws, retryTag);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user