From 2021075184461302d390bcc7ec1faf65dbc114b9 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Tue, 11 Jul 2023 15:00:48 -0400 Subject: [PATCH] fix(core): Drop long idle transactions --- packages/core/src/tracing/idletransaction.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/core/src/tracing/idletransaction.ts b/packages/core/src/tracing/idletransaction.ts index 9f7964a33f3f..ccfdf805abd6 100644 --- a/packages/core/src/tracing/idletransaction.ts +++ b/packages/core/src/tracing/idletransaction.ts @@ -170,8 +170,15 @@ export class IdleTransaction extends Transaction { }); __DEBUG_BUILD__ && logger.log('[Tracing] flushing IdleTransaction'); - } else { - __DEBUG_BUILD__ && logger.log('[Tracing] No active IdleTransaction'); + + console.log(endTimestamp, this.startTimestamp, this._finalTimeout, this._idleTimeout); + console.log(endTimestamp - this.startTimestamp > this._finalTimeout + this._idleTimeout); + + if (endTimestamp - this.startTimestamp < this._finalTimeout + this._idleTimeout) { + __DEBUG_BUILD__ && logger.log('[Tracing] IdleTransaction duration exceeded finalTimeout, dropping transaction'); + this.endTimestamp = endTimestamp; + return; + } } // if `this._onScope` is `true`, the transaction put itself on the scope when it started