File tree 1 file changed +4
-3
lines changed
packages/opentelemetry/src
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -105,8 +105,9 @@ export class SentrySpanExporter {
105
105
* We do this to avoid leaking memory.
106
106
*/
107
107
private _cleanupOldSpans ( spans = this . _finishedSpans ) : void {
108
+ const currentTimeSeconds = Date . now ( ) / 1000 ;
108
109
this . _finishedSpans = spans . filter ( span => {
109
- const shouldDrop = shouldCleanupSpan ( span , this . _timeout ) ;
110
+ const shouldDrop = shouldCleanupSpan ( span , currentTimeSeconds , this . _timeout ) ;
110
111
DEBUG_BUILD &&
111
112
shouldDrop &&
112
113
logger . log (
@@ -174,8 +175,8 @@ function getCompletedRootNodes(nodes: SpanNode[]): SpanNodeCompleted[] {
174
175
return nodes . filter ( nodeIsCompletedRootNode ) ;
175
176
}
176
177
177
- function shouldCleanupSpan ( span : ReadableSpan , maxStartTimeOffsetSeconds : number ) : boolean {
178
- const cutoff = Date . now ( ) / 1000 - maxStartTimeOffsetSeconds ;
178
+ function shouldCleanupSpan ( span : ReadableSpan , currentTimeSeconds : number , maxStartTimeOffsetSeconds : number ) : boolean {
179
+ const cutoff = currentTimeSeconds - maxStartTimeOffsetSeconds ;
179
180
return spanTimeInputToSeconds ( span . startTime ) < cutoff ;
180
181
}
181
182
You can’t perform that action at this time.
0 commit comments