fix: Don't cache requests with params (#3113)

`ResponseExpirationCache` is using only `method` (or `command`) as a
key, but responses might be different with different params. This may
lead to a client getting incorrect response because of caching. This PR
fixes it by caching only requests without any additional params.
This commit is contained in:
Sergey Kuznetsov
2026-06-26 12:33:27 +01:00
committed by GitHub
parent 0b20dc728a
commit 87f0b480bf
7 changed files with 246 additions and 25 deletions

View File

@@ -141,7 +141,7 @@ public:
}
if (not ctx.isAdmin and responseCache_) {
if (auto res = responseCache_->get(ctx.method); res.has_value())
if (auto res = responseCache_->get(ctx.method, ctx.params); res.has_value())
return Result{*std::move(res)};
}
@@ -174,7 +174,7 @@ public:
if (not v) {
notifyErrored(ctx.method);
} else if (not ctx.isAdmin and responseCache_) {
responseCache_->put(ctx.method, v.result->as_object());
responseCache_->put(ctx.method, ctx.params, v.result->as_object());
}
return Result{std::move(v)};