@helium/account-fetch-cache
Advanced tools
Comparing version 0.6.15 to 0.6.16
@@ -62,3 +62,3 @@ "use strict"; | ||
class AccountFetchCache { | ||
constructor({ connection, chunkSize = exports.DEFAULT_CHUNK_SIZE, delay = exports.DEFAULT_DELAY, commitment, missingRefetchDelay = 10000, extendConnection = false, cache, }) { | ||
constructor({ connection, chunkSize = exports.DEFAULT_CHUNK_SIZE, delay = exports.DEFAULT_DELAY, commitment, missingRefetchDelay = 10000, extendConnection = false, cache, enableLogging = false, }) { | ||
this.accountWatchersCount = new Map(); | ||
@@ -74,2 +74,3 @@ this.accountChangeListeners = new Map(); | ||
this.emitter = new eventEmitter_1.EventEmitter(); | ||
this.enableLogging = enableLogging; | ||
this.genericCache = cache || new MapAccountCache(); | ||
@@ -167,2 +168,5 @@ this.id = ++id; | ||
this.currentBatch = new Set(); // Erase current batch from state, so we can fetch multiple at a time | ||
if (this.enableLogging) { | ||
console.log(`Fetching batch of ${currentBatch.size} accounts`); | ||
} | ||
try { | ||
@@ -169,0 +173,0 @@ const keys = Array.from(currentBatch); |
@@ -46,2 +46,3 @@ import { Connection, PublicKey, Transaction, } from "@solana/web3.js"; | ||
export class AccountFetchCache { | ||
enableLogging; | ||
connection; | ||
@@ -67,3 +68,4 @@ chunkSize; | ||
missingInterval; | ||
constructor({ connection, chunkSize = DEFAULT_CHUNK_SIZE, delay = DEFAULT_DELAY, commitment, missingRefetchDelay = 10000, extendConnection = false, cache, }) { | ||
constructor({ connection, chunkSize = DEFAULT_CHUNK_SIZE, delay = DEFAULT_DELAY, commitment, missingRefetchDelay = 10000, extendConnection = false, cache, enableLogging = false, }) { | ||
this.enableLogging = enableLogging; | ||
this.genericCache = cache || new MapAccountCache(); | ||
@@ -152,2 +154,5 @@ this.id = ++id; | ||
this.currentBatch = new Set(); // Erase current batch from state, so we can fetch multiple at a time | ||
if (this.enableLogging) { | ||
console.log(`Fetching batch of ${currentBatch.size} accounts`); | ||
} | ||
try { | ||
@@ -154,0 +159,0 @@ const keys = Array.from(currentBatch); |
@@ -29,2 +29,3 @@ /// <reference types="node" /> | ||
export declare class AccountFetchCache { | ||
enableLogging: boolean; | ||
connection: Connection; | ||
@@ -50,3 +51,3 @@ chunkSize: number; | ||
missingInterval: NodeJS.Timeout; | ||
constructor({ connection, chunkSize, delay, commitment, missingRefetchDelay, extendConnection, cache, }: { | ||
constructor({ connection, chunkSize, delay, commitment, missingRefetchDelay, extendConnection, cache, enableLogging, }: { | ||
connection: Connection; | ||
@@ -60,2 +61,3 @@ chunkSize?: number; | ||
cache?: AccountCache; | ||
enableLogging?: boolean; | ||
}); | ||
@@ -62,0 +64,0 @@ requeryMissing(instructions: TransactionInstruction[]): Promise<void>; |
{ | ||
"name": "@helium/account-fetch-cache", | ||
"version": "0.6.15", | ||
"version": "0.6.16", | ||
"description": "Solana account fetch cache to eliminate reduntant fetching, and batch fetches", | ||
@@ -41,3 +41,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "6b303c8ddf16903d4c4d8cb9bf2e1f6905b3b933" | ||
"gitHead": "d2225406239148ac56158ca0e022a836dd815a37" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
151003
1334