Open mahnunchik opened 1 month ago
What are your assumptions on why this wouldn't work in a multi process environment? The only thing that shouldn't work is request deduplication when each of them are being used in a different process.
@arthurfiorette Exactly this case! Identical simultaneous requests from 2+ processes.
It looks like in the current implementation the second+ request will fail with an error.
Since the waiting
list is now just a promise map that resolves with nothing, that could change to an event emitter interface that could be extended by your redis instance to emit events real time.
Are you up to a PR? remember to add unit tests.
Actually I'm working with MongoDB as a storage provider, there is no simple way to emit event between instances.
if your storage provider isn't capable of sending/receiving events, there's not much we would be able to do anyways... If your case is highly needed, lookup the cost of actually running a redis instance as a cache provider.
What happened?
I quickly ran through the code and it looks like the module will not work correctly with cache if used with persistent storage (Redis for example https://axios-cache-interceptor.js.org/guide/storages#node-redis-storage) in a multi-process environment.
axios-cache-interceptor version
1.6.1
Node / Browser Version
20
Axios Version
1.7.7
What storage is being used
Another one
Relevant debugging log output