'WIP: [expireOnNodes] failed to parse "swarm" result. firstExpirationResult is null'
);
thrownewError('firstExpirationResult is null');
}
constmessageHash=firstExpirationResult[0];
constmessageHash=firstExpirationResult[0];
constexpiry=firstExpirationResult[1].expiry;
constexpiry=firstExpirationResult[1].expiry;
if(!expiry||!messageHash){
if(!expiry||!messageHash){
thrownewError(
thrownewError(
`Something is wrong with the firstExpirationResult: ${JSON.stringify(
`Something is wrong with the firstExpirationResult: ${JSON.stringify(
JSON.stringify(firstExpirationResult)
JSON.stringify(firstExpirationResult)
)}`
)}`
);
);
}
}
// window.log.debug(
// window.log.debug(
// `WIP: [expireOnNodes] Success!\nHere are the results from one of the snodes.\nmessageHash: ${messageHash} \nexpiry: ${expiry} \nexpires at: ${new Date(
// `WIP: [expireOnNodes] Success!\nHere are the results from one of the snodes.\nmessageHash: ${messageHash} \nexpiry: ${expiry} \nexpires at: ${new Date(
window?.log?.warn('WIP: [expireOnNodes] Failed to parse "swarm" result: ',e);
}
returnnull;
}catch(e){
window?.log?.warn(
window?.log?.warn(
'WIP: [expireOnNodes] - send error:',
'WIP: [expireOnNodes]',
e,
err.message||err,
`destination ${targetNode.ip}:${targetNode.port}`
`destination ${targetNode.ip}:${targetNode.port}`
);
);
throwe;
// NOTE batch requests have their own retry logic which includes abort errors that will break our retry logic so we need to catch them and throw regular errors
if(errinstanceofpRetry.AbortError){
throwError(err.message);
}
throwerr;
}
}
}
}
@ -299,38 +294,19 @@ export async function expireMessageOnSnode(
letsnode: Snode|undefined;
letsnode: Snode|undefined;
awaitpRetry(
async()=>{
constswarm=awaitgetSwarmFor(ourPubKey);
snode=sample(swarm);
if(!snode){
thrownewEmptySwarmError(ourPubKey,'Ran out of swarm nodes to query');