Skip to content

Commit

Permalink
fix websocket setting liq
Browse files Browse the repository at this point in the history
  • Loading branch information
wphan committed Dec 8, 2023
1 parent 73b3def commit 2c8f9a4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"clean": "rm -rf lib",
"start": "node lib/index.js",
"dev": "NODE_OPTIONS=--max-old-space-size=8192 ts-node src/index.ts",
"dev:inspect": "node --inspect-brk --require ts-node/register",
"dev:inspect": "node --inspect --require ts-node/register src/index.ts",
"dev:filler": "ts-node src/index.ts --filler",
"dev:trigger": "ts-node src/index.ts --trigger",
"dev:jitmaker": "ts-node src/index.ts --jit-maker",
Expand Down
14 changes: 10 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ const runBot = async () => {
resubTimeoutMs?: number;
commitment?: Commitment;
} = {
type: 'polling',
frequency: 60_000,
type: 'websocket',
resubTimeoutMs: 30_000,
commitment: stateCommitment,
};

Expand All @@ -239,8 +239,8 @@ const runBot = async () => {
frequency: config.global.eventSubscriberPollingInterval,
};
userMapSubscriptionConfig = {
type: 'websocket',
resubTimeoutMs: 30_000,
type: 'polling',
frequency: 60_000,
commitment: stateCommitment,
};
}
Expand Down Expand Up @@ -628,12 +628,18 @@ const runBot = async () => {
await sleepMs(1000);
}
}
logger.info(`Checking user exists: ${needCheckDriftUser}`);
if (needCheckDriftUser) await checkUserExists(config, driftClient, wallet);
logger.info(`Checking if bot needs collateral: ${needForceCollateral}`);
if (needForceCollateral)
await checkAndForceCollateral(config, driftClient, wallet);
logger.info(`Checking if need eventSubscriber: ${eventSubscriber}`);
if (eventSubscriber) await eventSubscriber.subscribe();
logger.info(`Checking if need usermap: ${needUserMapSubscribe}`);
if (needUserMapSubscribe) await userMap.subscribe();
logger.info(`Checking if need auctionSubscriber: ${auctionSubscriber}`);
if (auctionSubscriber) await auctionSubscriber.subscribe();
logger.info(`Checking if need jitter: ${jitter}`);
if (jitter) {
const freeCollateral = driftClient
.getUser()
Expand Down

0 comments on commit 2c8f9a4

Please sign in to comment.