Skip to content

Commit bee9b73

Browse files
committed
chore: clean up logs
1 parent 1a23348 commit bee9b73

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

src/loader/chart/utils.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { and, eq, between, lte, desc, or, inArray } from 'drizzle-orm';
33
import _ from 'lodash';
44
import { BigNumber, bignumber, max, min } from 'mathjs';
55

6+
import { Interval } from './types';
7+
68
import { LONG_CACHE_TTL } from '~/config/constants';
79
import { Timeframe, TIMEFRAME_ROUNDING } from '~/controllers/main-controller.constants';
810
import { db } from '~/database/client';
@@ -13,8 +15,6 @@ import { toNearestDate } from '~/utils/date';
1315
import { logger } from '~/utils/logger';
1416
import { prettyNumber } from '~/utils/numbers';
1517

16-
import { Interval } from './types';
17-
1818
export const constructCandlesticks = async (intervals: Interval[], timeframe: number) => {
1919
const groups = groupIntervals(intervals, timeframe);
2020

@@ -95,7 +95,6 @@ export const getPrices = async (
9595

9696
if (baseTokenData.length === 0 || quoteTokenData.length === 0) {
9797
// no data to build the chart...
98-
logger.warn('No data to build the chart');
9998
return [];
10099
}
101100

@@ -104,11 +103,6 @@ export const getPrices = async (
104103
let start = dayjs(tokenData.start).startOf(unit);
105104
const end = dayjs(endTimestamp).startOf(unit).unix();
106105

107-
logger.info(
108-
{ s: startTimestamp.toISOString(), start: start.toISOString(), end: dayjs(endTimestamp).toISOString() },
109-
'Building chart',
110-
);
111-
112106
const items: PriceItem[] = [];
113107

114108
while (start.unix() <= end) {

src/workers/chart-worker.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { workerData, Worker, isMainThread, parentPort, threadId } from 'node:worker_threads';
1+
import { workerData, Worker, isMainThread, parentPort } from 'node:worker_threads';
22

33
import { Timeframe, TIMEFRAMES } from '~/controllers/main-controller.constants';
44
import { constructCandlesticks, getPrices } from '~/loader/chart/utils';
5-
import { logger } from '~/utils/logger';
65

76
export function buildCandlesticksOnWorker(
87
chainId: number,
@@ -21,17 +20,14 @@ export function buildCandlesticksOnWorker(
2120
worker.terminate();
2221
});
2322
worker.on('error', reject);
24-
worker.on('online', () => logger.info('worker online'));
2523
worker.on('exit', (code) => {
26-
logger.info({ code }, 'worker exited');
2724
if (code !== 0) reject(new Error(`Worker stopped with exit code ${code}`));
2825
});
2926
});
3027
}
3128

3229
if (!isMainThread) {
3330
(async () => {
34-
logger.info({ threadId }, 'running worker process');
3531
const [chainId, baseTokenAddress, quoteTokenAddress, start, end, timeframe] = workerData;
3632
const intervals = await getPrices(chainId, baseTokenAddress, quoteTokenAddress, start, end, timeframe);
3733
const candlesticks = await constructCandlesticks(intervals, TIMEFRAMES[timeframe]);

0 commit comments

Comments
 (0)