improve(buffer): don't add profile if its from an event and already created
This commit is contained in:
@@ -53,7 +53,7 @@ export class ProfileBuffer extends BaseBuffer {
|
||||
return `${this.redisProfilePrefix}${projectId}:${profileId}`;
|
||||
}
|
||||
|
||||
async add(profile: IClickhouseProfile) {
|
||||
async add(profile: IClickhouseProfile, isFromEvent = false) {
|
||||
const logger = this.logger.child({
|
||||
projectId: profile.project_id,
|
||||
profileId: profile.id,
|
||||
@@ -64,6 +64,11 @@ export class ProfileBuffer extends BaseBuffer {
|
||||
|
||||
const existingProfile = await this.fetchFromCache(profile, logger);
|
||||
|
||||
if (isFromEvent && existingProfile) {
|
||||
logger.debug('Profile already created, skipping');
|
||||
return;
|
||||
}
|
||||
|
||||
const mergedProfile: IClickhouseProfile = existingProfile
|
||||
? deepMergeObjects(existingProfile, profile)
|
||||
: profile;
|
||||
|
||||
Reference in New Issue
Block a user