LRU Sizing (#4872)
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
// Copyright 2017-2022 @polkadot/rpc-provider authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Assuming all 1.5MB responses, we apply a default allowing for 576MB
|
||||
// Assuming all 1.5MB responses, we apply a default allowing for 192MB
|
||||
// cache space (depending on the historic queries this would vary, metadata
|
||||
// for Kusama/Polkadot/Substrate falls between 600-750K, 2x for estimate)
|
||||
const DEFAULT_CAPACITY = 384;
|
||||
const DEFAULT_CAPACITY = 128;
|
||||
|
||||
class LRUNode {
|
||||
public readonly key: string;
|
||||
|
||||
@@ -300,7 +300,7 @@ export class WsProvider implements ProviderInterface {
|
||||
|
||||
const [id, body] = this.#coder.encodeJson(method, params);
|
||||
let resultPromise: Promise<T> | null = isCacheable
|
||||
? this.#callCache.get(body) as Promise<T>
|
||||
? this.#callCache.get(body)
|
||||
: null;
|
||||
|
||||
if (!resultPromise) {
|
||||
|
||||
Reference in New Issue
Block a user