-
-
Notifications
You must be signed in to change notification settings - Fork 218
Error: ClusterMemoryStoreWorker:1: response recieved without matching open request #457
Replies: 1 comment · 5 replies
-
Does this happen often, or just the one time? Can you set the environment property |
Beta Was this translation helpful? Give feedback.
All reactions
-
Thanks for reply.
|
Beta Was this translation helpful? Give feedback.
All reactions
-
I have added code snippet also. maybe i am doing something wrong. |
Beta Was this translation helpful? Give feedback.
All reactions
-
Ok, I think I see the issue. You're trying to use the same instance of Resolve this by creating new instances of const rateLimitDefault = {
standardHeaders: 'draft-7',
legacyHeaders: false,
debug: false,
}
const strongestRateLimit = rateLimit({
...rateLimitDefault,
store: new ClusterMemoryStoreWorker({prefix: 'strongest'}),
windowMs: 60 * 1000,
max: 10 * maxMultiple,
})
const strongRateLimit = rateLimit({
...rateLimitDefault,
store: new ClusterMemoryStoreWorker({prefix: 'strong'}),
windowMs: 60 * 1000,
max: 100 * maxMultiple,
})
const generalRateLimit = rateLimit({
...rateLimitDefault,
store: new ClusterMemoryStoreWorker({prefix: 'general'}),
windowMs: 60 * 1000,
max: 100 * maxMultiple,
}) Separate instances ensures that each message gets handled exactly once, and the unique prefixes ensure that a user who makes 11 |
Beta Was this translation helpful? Give feedback.
All reactions
-
I tried with the above mentioned way. I am still getting same error message. I think it is because in it should check Here is code for current implementation of onMessage(message) {
debug$1("Recieved message %o", message);
if (message?.from === from) {
const message_ = message;
if (this.openRequests.has(message_.requestId)) {
const { timeoutId, resolve } = this.openRequests.get(
message_.requestId
);
this.openRequests.delete(message_.requestId);
clearTimeout(timeoutId);
resolve(message_.result);
} else {
console.warn(
new Error(
`${errorPrefix} response recieved without matching open request: ` + JSON.stringify(message_)
)
);
}
}
} |
Beta Was this translation helpful? Give feedback.
All reactions
-
Oh, I think you're right! Rather than prefix, I might give it an instance counter, but you're right that it needs something to differentiate between multiple instances and only handle messages for itself. |
Beta Was this translation helpful? Give feedback.
-
I am using @express-rate-limit/cluster-memory-store and getting following error anyone can help
Here is the code snippet.
Beta Was this translation helpful? Give feedback.
All reactions