Skip to content
Discussion options

You must be logged in to vote

Hi @niksy, sorry for the slow reply!

Instances: right, you don't need to share the lock instance the way you do with async-mutex. The lock lives in Redis under its key, so any instance with the same key, in this process or another, competes for the same lock. One correction, though: the identifier is created per acquisition, not per instance. Every acquire() generates a new random token and returns it in the handle. So one shared instance can safely serve concurrent requests, and an instance per request works too.

The differences are minor. A new instance pings Redis once, on its first acquire(): that's the health check of the built-in circuit breaker, and circuitBreaker: false turns it o…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by alexpota
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants