18
src/index.ts
18
src/index.ts
@@ -289,11 +289,19 @@ const main = async () => {
|
|||||||
const recursiveFetch = (delay = WS_FALLBACK_FETCH_INTERVAL) => {
|
const recursiveFetch = (delay = WS_FALLBACK_FETCH_INTERVAL) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const startFetch = Date.now();
|
const startFetch = Date.now();
|
||||||
dlobProvider.fetch().then(() => {
|
dlobProvider
|
||||||
gpaFetchDurationHistogram.record(Date.now() - startFetch);
|
.fetch()
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
.then(() => {
|
||||||
recursiveFetch();
|
gpaFetchDurationHistogram.record(Date.now() - startFetch);
|
||||||
});
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
logger.error('Failed to fetch GPA');
|
||||||
|
console.log(e);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
recursiveFetch();
|
||||||
|
});
|
||||||
}, delay);
|
}, delay);
|
||||||
};
|
};
|
||||||
recursiveFetch();
|
recursiveFetch();
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import {
|
|||||||
getDLOBProviderFromOrderSubscriber,
|
getDLOBProviderFromOrderSubscriber,
|
||||||
getDLOBProviderFromUserMap,
|
getDLOBProviderFromUserMap,
|
||||||
} from '../dlobProvider';
|
} from '../dlobProvider';
|
||||||
|
import FEATURE_FLAGS from '../utils/featureFlags';
|
||||||
|
|
||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
const stateCommitment: Commitment = 'processed';
|
const stateCommitment: Commitment = 'processed';
|
||||||
@@ -229,10 +230,22 @@ const main = async () => {
|
|||||||
spotMarketSubscribers: MARKET_SUBSCRIBERS,
|
spotMarketSubscribers: MARKET_SUBSCRIBERS,
|
||||||
});
|
});
|
||||||
await dlobSubscriber.subscribe();
|
await dlobSubscriber.subscribe();
|
||||||
if (useWebsocket) {
|
if (useWebsocket && !FEATURE_FLAGS.DISABLE_GPA_REFRESH) {
|
||||||
setInterval(async () => {
|
const recursiveFetch = (delay = WS_FALLBACK_FETCH_INTERVAL) => {
|
||||||
await dlobProvider.fetch();
|
setTimeout(() => {
|
||||||
}, WS_FALLBACK_FETCH_INTERVAL);
|
dlobProvider
|
||||||
|
.fetch()
|
||||||
|
.catch((e) => {
|
||||||
|
logger.error('Failed to fetch GPA');
|
||||||
|
console.log(e);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
recursiveFetch();
|
||||||
|
});
|
||||||
|
}, delay);
|
||||||
|
};
|
||||||
|
recursiveFetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('DLOBSubscriber Publishing Messages');
|
console.log('DLOBSubscriber Publishing Messages');
|
||||||
|
|||||||
Reference in New Issue
Block a user