Closed Chiyo-no-sake closed 8 months ago
Hi @Chiyo-no-sake, I was guessing that this problem might occur. Previously, in order to avoid this problem, I used the nestjs-cls
package and managed the clientId on a request basis, but that package constantly caused dependency problems. I guess, if a different context is opened for each request in async-local-storage
and managed there, such a problem will not be encountered, I will make an improvement for this.
Hi @Chiyo-no-sake, I released the new version to solve this issue. https://www.npmjs.com/package/murlock/v/3.2.0 you can check this, fyi
This is pretty much self explainatory, but for instance, take the following logs:
Above you can see two parallel requests being handled by Nest, as you see Murlock assigns both requests the same clientID and allows for both to acquire the lock, despite having the same key. This results in multiple concurrency problems, and leads to the following murlock error when the latter request finishes:
Here's my config:
I can just suppose that the problem is the clientID being the same for the whole instance, instead of changing for each handled request (?)
Is there any workaround to this? Is this a Bug or am I using this lib incorrectly?