From 2755d03b71db528cfeca82a9e700e65f4ee892da Mon Sep 17 00:00:00 2001 From: Ben White Date: Thu, 22 Feb 2024 10:42:05 +0000 Subject: [PATCH] Fixes --- .../session-recording/services/session-manager-v3.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugin-server/src/main/ingestion-queues/session-recording/services/session-manager-v3.ts b/plugin-server/src/main/ingestion-queues/session-recording/services/session-manager-v3.ts index ea9b8991bd18f..49d9001f86de2 100644 --- a/plugin-server/src/main/ingestion-queues/session-recording/services/session-manager-v3.ts +++ b/plugin-server/src/main/ingestion-queues/session-recording/services/session-manager-v3.ts @@ -151,7 +151,7 @@ export class SessionManagerV3 { return manager } - private async save(): Promise { + private async syncMetadata(): Promise { if (this.buffer) { await writeFile(this.file('metadata.json'), JSON.stringify(this.buffer?.context), 'utf-8') } else { @@ -205,12 +205,12 @@ export class SessionManagerV3 { buffer.context.count += 1 buffer.context.sizeEstimate += content.length - await this.save() - if (!buffer.fileStream.write(content, 'utf-8')) { writeStreamBlocked.inc() await new Promise((r) => buffer.fileStream.once('drain', r)) } + + await this.syncMetadata() } catch (error) { this.captureException(error, { message }) throw error @@ -296,7 +296,7 @@ export class SessionManagerV3 { await rename(this.file(BUFFER_FILE_NAME), this.file(fileName)) this.buffer = undefined - await this.save() + await this.syncMetadata() } private async flushFiles(): Promise {