Create distributed semaphores to control concurrent invocations of contentious work using AWS Step Functions, Amazon DynamoDB, and AWS Cloud Development Kit.
I recently used this with a distributed map state that called Amazon Bedrock. I needed to ensure that only one execution runs at a time. Each execution takes multiple minutes, so polling every three seconds is excessive. In that case, I would have liked to have it wait one minute.
Proposal
Add a prop named wait that takes a Duration and use that in waitToGetLock.
What happens when the job fails? Is there a mechanism in place to clean-up / release the lock? Like add a catch to the job that handles releasing the lock for example? In the article mentioned in the readme and event bridge rule is used to release the lock. This has the benefit of releasing the lock in the case of a timeout as well.