Skip to content

Commit

Permalink
Remove obsolete job
Browse files Browse the repository at this point in the history
  • Loading branch information
AllFi committed Jul 10, 2024
1 parent 404597f commit 5e21934
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion zp-relayer/pool/BasePool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export abstract class BasePool<N extends Network = Network> {
newLocalIndex,
})
if (newLocalIndex < contractIndex) {
throw new Error('Indexer is not syncronized with the contract yet')
throw new Error('Indexer is not synchronized with the contract yet')
}
if (newLocalRoot !== contractRoot) {
throw new Error('State is corrupted, roots mismatch')
Expand Down
11 changes: 8 additions & 3 deletions zp-relayer/services/commitment-watcher/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@ async function processCommitment(pendingCommitment: PendingCommitment) {
}

const existingJob = await poolTxQueue.getJob(commitment);
if (existingJob && existingJob.data.transaction.state !== JobState.FAILED) {
logger.info('Job already created, waiting...', { commitment })
return
if (existingJob) {
if (existingJob.data.transaction.state === JobState.FAILED) {
logger.info('Job failed, repeating...', { commitment })
await poolTxQueue.remove(commitment);
} else {
logger.info('Job already created, waiting...', { commitment })
return
}
}

const job = await poolTxQueue.add(
Expand Down

0 comments on commit 5e21934

Please sign in to comment.