Skip to content

Commit

Permalink
Merge pull request #243 from bnb-chain/hotfix/cache0105
Browse files Browse the repository at this point in the history
fix: Remove cache time
  • Loading branch information
wenty22 authored Jan 5, 2025
2 parents 6513b88 + 02c5f5c commit 18cae4a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
3 changes: 1 addition & 2 deletions apps/canonical-bridge-server/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { AllExceptionFilter } from './common/filters/all-exception.filter';
import { HttpExceptionFilter } from './common/filters/http-exception.filter';
import { TransformInterceptor } from './common/interceptors/transform.interceptor';
import { TimeoutInterceptor } from './common/interceptors/timeout.interceptor';
import { REDIS_HOST, REDIS_PORT, TIME } from './common/constants';
import { REDIS_HOST, REDIS_PORT } from './common/constants';
import { TokenModule } from './module/token/token.module';
import { BullModule } from '@nestjs/bullmq';
import { Web3Module } from '@/shared/web3/web3.module';
Expand All @@ -32,7 +32,6 @@ import { BridgeModule } from '@/module/bridge/bridge.module';
HealthModule,
ScheduleModule.forRoot(),
CacheModule.register<RedisOptions>({
ttl: TIME.DAY,
isGlobal: true,
store: () => redisStore({ host: REDIS_HOST, port: REDIS_PORT }),
}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CACHE_KEY, Queues, Tasks, TIME } from '@/common/constants';
import { CACHE_KEY, Queues, Tasks } from '@/common/constants';
import { Processor, WorkerHost } from '@nestjs/bullmq';
import { Inject, Logger } from '@nestjs/common';
import { Job } from 'bullmq';
Expand Down Expand Up @@ -45,24 +45,24 @@ export class BridgeProcessor extends WorkerHost {

const data = { chains: config.chains, tokens: tokenMap };

await this.cache.set(`${CACHE_KEY.DEBRIDGE_CONFIG}`, data, TIME.DAY);
await this.cache.set(`${CACHE_KEY.DEBRIDGE_CONFIG}`, data);
}

async fetchCBridge() {
const config = await this.web3Service.getTransferConfigsForAll();
if (!config) return;
await this.cache.set(`${CACHE_KEY.CBRIDGE_CONFIG}`, config, TIME.DAY);
await this.cache.set(`${CACHE_KEY.CBRIDGE_CONFIG}`, config);
}

async fetchStargate() {
const config = await this.web3Service.getStargateConfigs();
if (!config) return;
await this.cache.set(`${CACHE_KEY.STARGATE_CONFIG}`, config, TIME.DAY);
await this.cache.set(`${CACHE_KEY.STARGATE_CONFIG}`, config);
}

async fetchMeson() {
const config = await this.web3Service.getMesonConfigs();
if (!config) return;
await this.cache.set(`${CACHE_KEY.MESON_CONFIG}`, config, TIME.DAY);
await this.cache.set(`${CACHE_KEY.MESON_CONFIG}`, config);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { InjectQueue, Processor, WorkerHost } from '@nestjs/bullmq';
import { Inject, Logger } from '@nestjs/common';
import { CACHE_KEY, JOB_KEY, Queues, Tasks, TIME, TOKEN_REQUEST_LIMIT } from '@/common/constants';
import { CACHE_KEY, JOB_KEY, Queues, Tasks, TOKEN_REQUEST_LIMIT } from '@/common/constants';
import { Job, Queue } from 'bullmq';
import { ITokenJob } from '@/module/token/token.interface';
import { Web3Service } from '@/shared/web3/web3.service';
Expand Down Expand Up @@ -57,7 +57,7 @@ export class TokenProcessor extends WorkerHost {
return r;
}, {});

await this.cache.set(`${CACHE_KEY.LLAMA_CONFIG}`, config, TIME.MONTH);
await this.cache.set(`${CACHE_KEY.LLAMA_CONFIG}`, config);
return config;
}

Expand All @@ -79,7 +79,7 @@ export class TokenProcessor extends WorkerHost {
return r;
}, {});

await this.cache.set(`${CACHE_KEY.CMC_CONFIG}`, config, TIME.MONTH);
await this.cache.set(`${CACHE_KEY.CMC_CONFIG}`, config);
return config;
}

Expand All @@ -101,7 +101,7 @@ export class TokenProcessor extends WorkerHost {
{} as Record<string, string>,
);

await this.cache.set(`${CACHE_KEY.PLATFORM_MAPPING}`, mapping, TIME.MONTH);
await this.cache.set(`${CACHE_KEY.PLATFORM_MAPPING}`, mapping);
this.tokenService.syncCoingeckoTokens(coins, platforms);
}

Expand Down

0 comments on commit 18cae4a

Please sign in to comment.