From e21cd7ed73c7d9c654de52dc6c3261d173764769 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl-Gerhard=20Lindesva=CC=88rd?= Date: Thu, 28 Nov 2024 21:11:22 +0100 Subject: [PATCH] revert --- packages/db/src/buffers/profile-buffer.ts | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/packages/db/src/buffers/profile-buffer.ts b/packages/db/src/buffers/profile-buffer.ts index a7973069..da33e596 100644 --- a/packages/db/src/buffers/profile-buffer.ts +++ b/packages/db/src/buffers/profile-buffer.ts @@ -4,12 +4,7 @@ import { toDots } from '@openpanel/common'; import { getRedisCache } from '@openpanel/redis'; import { escape } from 'sqlstring'; -import { - TABLE_NAMES, - ch, - chQuery, - formatClickhouseDate, -} from '../clickhouse-client'; +import { TABLE_NAMES, ch, chQuery } from '../clickhouse-client'; import { transformProfile } from '../services/profile.service'; import type { IClickhouseProfile, @@ -28,15 +23,6 @@ export class ProfileBuffer extends RedisBuffer { super(TABLE_NAMES.profiles, BATCH_SIZE); } - protected transformProfiles(profiles: IClickhouseProfile[]): BufferType[] { - return profiles.map((profile) => ({ - ...profile, - created_at: profile.created_at - ? formatClickhouseDate(profile.created_at) - : '', - })); - } - // this will do a couple of things: // - we slice the queue to maxBufferSize since this queries have a limit on character count // - check redis cache for profiles @@ -54,14 +40,12 @@ export class ProfileBuffer extends RedisBuffer { slicedQueue.filter((_, index) => !redisProfiles[index]), ); - const profiles = this.createProfileValues( + const toInsert = this.createProfileValues( slicedQueue, redisProfiles, dbProfiles, ); - const toInsert = this.transformProfiles(profiles); - if (toInsert.length > 0) { await this.updateRedisCache(toInsert); }