undefined guard and remove resubscribe for drift client
This commit is contained in:
18
src/index.ts
18
src/index.ts
@@ -789,8 +789,8 @@ const main = async () => {
|
|||||||
if (useRedis) {
|
if (useRedis) {
|
||||||
if (
|
if (
|
||||||
!isSpot &&
|
!isSpot &&
|
||||||
`${includeVamm}`.toLowerCase() === 'true' &&
|
`${includeVamm}`?.toLowerCase() === 'true' &&
|
||||||
`${includeOracle}`.toLowerCase().toLowerCase() === 'true' &&
|
`${includeOracle}`?.toLowerCase() === 'true' &&
|
||||||
!grouping
|
!grouping
|
||||||
) {
|
) {
|
||||||
let redisL2: string;
|
let redisL2: string;
|
||||||
@@ -814,9 +814,9 @@ const main = async () => {
|
|||||||
l2Formatted = redisL2;
|
l2Formatted = redisL2;
|
||||||
} else if (
|
} else if (
|
||||||
isSpot &&
|
isSpot &&
|
||||||
`${includeSerum}`.toLowerCase() === 'true' &&
|
`${includeSerum}`?.toLowerCase() === 'true' &&
|
||||||
`${includePhoenix}`.toLowerCase() === 'true' &&
|
`${includePhoenix}`?.toLowerCase() === 'true' &&
|
||||||
`${includeOracle}`.toLowerCase() === 'true' &&
|
`${includeOracle}`?.toLowerCase() === 'true' &&
|
||||||
!grouping
|
!grouping
|
||||||
) {
|
) {
|
||||||
let redisL2: string;
|
let redisL2: string;
|
||||||
@@ -971,8 +971,8 @@ const main = async () => {
|
|||||||
if (useRedis) {
|
if (useRedis) {
|
||||||
if (
|
if (
|
||||||
!isSpot &&
|
!isSpot &&
|
||||||
normedParam['includeVamm'].toLowerCase() === 'true' &&
|
normedParam['includeVamm']?.toLowerCase() === 'true' &&
|
||||||
normedParam['includeOracle'].toLowerCase() === 'true' &&
|
normedParam['includeOracle']?.toLowerCase() === 'true' &&
|
||||||
!normedParam['grouping']
|
!normedParam['grouping']
|
||||||
) {
|
) {
|
||||||
let redisL2: string;
|
let redisL2: string;
|
||||||
@@ -996,8 +996,8 @@ const main = async () => {
|
|||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
isSpot &&
|
isSpot &&
|
||||||
normedParam['includePhoenix'].toLowerCase() === 'true' &&
|
normedParam['includePhoenix']?.toLowerCase() === 'true' &&
|
||||||
normedParam['includeSerum'].toLowerCase() === 'true' &&
|
normedParam['includeSerum']?.toLowerCase() === 'true' &&
|
||||||
!normedParam['grouping']
|
!normedParam['grouping']
|
||||||
) {
|
) {
|
||||||
let redisL2: string;
|
let redisL2: string;
|
||||||
|
|||||||
@@ -60,7 +60,8 @@ const useOrderSubscriber =
|
|||||||
const useGrpc = process.env.USE_GRPC?.toLowerCase() === 'true';
|
const useGrpc = process.env.USE_GRPC?.toLowerCase() === 'true';
|
||||||
const useWebsocket = process.env.USE_WEBSOCKET?.toLowerCase() === 'true';
|
const useWebsocket = process.env.USE_WEBSOCKET?.toLowerCase() === 'true';
|
||||||
|
|
||||||
const ORDERBOOK_UPDATE_INTERVAL = 1000;
|
const ORDERBOOK_UPDATE_INTERVAL =
|
||||||
|
parseInt(process.env.ORDERBOOK_UPDATE_INTERVAL) || 1000;
|
||||||
const WS_FALLBACK_FETCH_INTERVAL = 10_000;
|
const WS_FALLBACK_FETCH_INTERVAL = 10_000;
|
||||||
|
|
||||||
logger.info(`RPC endpoint: ${endpoint}`);
|
logger.info(`RPC endpoint: ${endpoint}`);
|
||||||
@@ -166,7 +167,6 @@ const main = async () => {
|
|||||||
accountSubscription = {
|
accountSubscription = {
|
||||||
type: 'websocket',
|
type: 'websocket',
|
||||||
commitment: stateCommitment,
|
commitment: stateCommitment,
|
||||||
resubTimeoutMs: 30_000,
|
|
||||||
};
|
};
|
||||||
slotSubscriber = new SlotSubscriber(connection);
|
slotSubscriber = new SlotSubscriber(connection);
|
||||||
await slotSubscriber.subscribe();
|
await slotSubscriber.subscribe();
|
||||||
|
|||||||
Reference in New Issue
Block a user