Adjust LRU historic size (clarify isCachable flag) (#4419)

This commit is contained in:
Jaco
2022-01-06 09:31:13 +02:00
committed by GitHub
parent 3a6c4a524a
commit 392d447b99
4 changed files with 14 additions and 1 deletions
+4 -1
View File
@@ -1,7 +1,10 @@
// Copyright 2017-2022 @polkadot/rpc-provider authors & contributors
// SPDX-License-Identifier: Apache-2.0
const DEFAULT_CAPACITY = 2048;
// Assuming all 1.5MB responses, we apply a default allowing for 576MB
// 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;
class LRUNode {
public readonly key: string;
+1
View File
@@ -328,6 +328,7 @@ export class WsProvider implements ProviderInterface {
* ```
*/
public subscribe (type: string, method: string, params: unknown[], callback: ProviderInterfaceCallback): Promise<number | string> {
// subscriptions are not cached, LRU applies to .at(<blockHash>) only
return this.send<number | string>(method, params, false, { callback, type });
}