make frequency configurable

This commit is contained in:
Nour Alharithi
2024-04-04 12:06:07 -07:00
parent 4883a1ee29
commit 486401444c

View File

@@ -41,6 +41,7 @@ const endpoint = token
? process.env.ENDPOINT + `/${token}` ? process.env.ENDPOINT + `/${token}`
: process.env.ENDPOINT; : process.env.ENDPOINT;
const wsEndpoint = process.env.WS_ENDPOINT; const wsEndpoint = process.env.WS_ENDPOINT;
const FEE_POLLING_FREQUENCY = parseInt(process.env.FEE_POLLING_FREQUENCY) || 5000;
if (!endpoint.includes('helius')) { if (!endpoint.includes('helius')) {
throw new Error('We use helius for fee publisher fellas'); throw new Error('We use helius for fee publisher fellas');
@@ -69,7 +70,7 @@ class PriorityFeeSubscriber {
this.perpMarketPubkeys = config.perpMarketPubkeys; this.perpMarketPubkeys = config.perpMarketPubkeys;
this.spotMarketPubkeys = config.spotMarketPubkeys; this.spotMarketPubkeys = config.spotMarketPubkeys;
this.redisClient = config.redisClient; this.redisClient = config.redisClient;
this.frequencyMs = config.frequencyMs ?? 5000; this.frequencyMs = config.frequencyMs ?? FEE_POLLING_FREQUENCY;
} }
async subscribe() { async subscribe() {