Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
flyingImer committed Mar 2, 2022
1 parent aa07b73 commit 64af8b4
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,22 @@ export class DistributedSemaphore extends Construct {
updateExpression: 'SET #currentlockcount = #currentlockcount - :decrease REMOVE #lockownerid',
conditionExpression: 'attribute_exists(#lockownerid)',
returnValues: DynamoReturnValues.UPDATED_NEW,
}).addRetry({
errors: ['DynamoDB.ConditionalCheckFailedException'],
maxAttempts: 0,
}).addRetry({
errors: [Errors.ALL],
maxAttempts: 5,
backoffRate: 1.5,
}).addCatch(
successState, {
errors: ['DynamoDB.ConditionalCheckFailedException'],
});
return getLock.next(doWork).next(releaseLock).next(successState);
});

return getLock
.next(doWork)
.next(
releaseLock.addRetry({
errors: ['DynamoDB.ConditionalCheckFailedException'],
maxAttempts: 0,
}).addRetry({
errors: [Errors.ALL],
maxAttempts: 5,
backoffRate: 1.5,
}).addCatch(
successState, {
errors: ['DynamoDB.ConditionalCheckFailedException'],
}))
.next(successState);
}
}

0 comments on commit 64af8b4

Please sign in to comment.