revamp server lite

This commit is contained in:
Nour Alharithi
2024-07-26 15:29:16 -07:00
parent 8924f66156
commit 3de6dc8f55
3 changed files with 211 additions and 411 deletions

View File

@@ -682,7 +682,9 @@ const main = async (): Promise<void> => {
if (useRedis) {
if (!isSpot && `${includeVamm}`?.toLowerCase() === 'true') {
const redisClient = perpMarketRedisMap.get(normedMarketIndex).client;
const redisL2 = await redisClient.get(`last_update_orderbook_perp_${normedMarketIndex}`);
const redisL2 = await redisClient.get(
`last_update_orderbook_perp_${normedMarketIndex}`
);
const depth = Math.min(parseInt(adjustedDepth as string) ?? 1, 100);
redisL2['bids'] = redisL2['bids']?.slice(0, depth);
redisL2['asks'] = redisL2['asks']?.slice(0, depth);
@@ -706,7 +708,9 @@ const main = async (): Promise<void> => {
`${includePhoenix}`?.toLowerCase() === 'true'
) {
const redisClient = spotMarketRedisMap.get(normedMarketIndex).client;
const redisL2 = await redisClient.get(`last_update_orderbook_spot_${normedMarketIndex}`);
const redisL2 = await redisClient.get(
`last_update_orderbook_spot_${normedMarketIndex}`
);
const depth = Math.min(parseInt(adjustedDepth as string) ?? 1, 100);
redisL2['bids'] = redisL2['bids']?.slice(0, depth);
redisL2['asks'] = redisL2['asks']?.slice(0, depth);
@@ -836,8 +840,13 @@ const main = async (): Promise<void> => {
) {
const redisClient =
perpMarketRedisMap.get(normedMarketIndex).client;
const redisL2 = await redisClient.get(`last_update_orderbook_perp_${normedMarketIndex}`);
const depth = Math.min(parseInt(adjustedDepth as string) ?? 1, 100);
const redisL2 = await redisClient.get(
`last_update_orderbook_perp_${normedMarketIndex}`
);
const depth = Math.min(
parseInt(adjustedDepth as string) ?? 1,
100
);
redisL2['bids'] = redisL2['bids']?.slice(0, depth);
redisL2['asks'] = redisL2['asks']?.slice(0, depth);
if (redisL2) {
@@ -861,8 +870,13 @@ const main = async (): Promise<void> => {
) {
const redisClient =
spotMarketRedisMap.get(normedMarketIndex).client;
const redisL2 = await redisClient.get(`last_update_orderbook_spot_${normedMarketIndex}`);
const depth = Math.min(parseInt(adjustedDepth as string) ?? 1, 100);
const redisL2 = await redisClient.get(
`last_update_orderbook_spot_${normedMarketIndex}`
);
const depth = Math.min(
parseInt(adjustedDepth as string) ?? 1,
100
);
redisL2['bids'] = redisL2['bids']?.slice(0, depth);
redisL2['asks'] = redisL2['asks']?.slice(0, depth);
if (redisL2) {