From 2ba377ff801394c099bdaa669a8f4a09264162fc Mon Sep 17 00:00:00 2001 From: Andronik Date: Thu, 13 Jan 2022 09:15:59 +0100 Subject: [PATCH] runtime-api: do not cache None SessionInfo (#4706) * approval-voting: add more logs * approval-voting: query finalized block on startup and increase look back * runtime-api: do not cache None SessionInfo --- node/core/runtime-api/src/cache.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/node/core/runtime-api/src/cache.rs b/node/core/runtime-api/src/cache.rs index 72206da8a114..d2582a26adb7 100644 --- a/node/core/runtime-api/src/cache.rs +++ b/node/core/runtime-api/src/cache.rs @@ -317,7 +317,10 @@ impl RequestResultCache { } pub(crate) fn cache_session_info(&mut self, key: SessionIndex, value: Option) { - self.session_info.insert(key, ResidentSizeOf(value)); + // only cache Some(SessionInfo) + if value.is_some() { + self.session_info.insert(key, ResidentSizeOf(value)); + } } pub(crate) fn dmq_contents(