1
1
/* eslint-disable max-lines */ // TODO: We might want to split this file up
2
2
import { addGlobalEventProcessor , captureException , getCurrentHub } from '@sentry/core' ;
3
- import type { Breadcrumb , ReplayRecordingMode , ReplayRecordingData } from '@sentry/types' ;
3
+ import type { Breadcrumb , ReplayRecordingData , ReplayRecordingMode } from '@sentry/types' ;
4
4
import type { RateLimits } from '@sentry/utils' ;
5
5
import { addInstrumentationHandler , disabledUntil , logger } from '@sentry/utils' ;
6
6
import { EventType , record } from 'rrweb' ;
@@ -20,6 +20,7 @@ import type {
20
20
AddUpdateCallback ,
21
21
AllPerformanceEntry ,
22
22
EventBuffer ,
23
+ FlushOptions ,
23
24
InstrumentationTypeBreadcrumb ,
24
25
InternalEventContext ,
25
26
PopEventContext ,
@@ -28,7 +29,6 @@ import type {
28
29
ReplayContainer as ReplayContainerInterface ,
29
30
ReplayPluginOptions ,
30
31
Session ,
31
- FlushOptions ,
32
32
} from './types' ;
33
33
import { addEvent } from './util/addEvent' ;
34
34
import { addMemoryEntry } from './util/addMemoryEntry' ;
@@ -152,7 +152,7 @@ export class ReplayContainer implements ReplayContainerInterface {
152
152
* Creates or loads a session, attaches listeners to varying events (DOM,
153
153
* _performanceObserver, Recording, Sentry SDK, etc)
154
154
*/
155
- public async start ( ) : Promise < void > {
155
+ public start ( ) : void {
156
156
this . _setInitialState ( ) ;
157
157
158
158
this . _loadSession ( { expiry : SESSION_IDLE_DURATION } ) ;
@@ -625,7 +625,7 @@ export class ReplayContainer implements ReplayContainerInterface {
625
625
// Send replay when the page/tab becomes hidden. There is no reason to send
626
626
// replay if it becomes visible, since no actions we care about were done
627
627
// while it was hidden
628
- this . _conditionalFlush ( { finishImmediate : true } ) ;
628
+ this . _conditionalFlush ( { finishImmediate : true } ) ;
629
629
}
630
630
631
631
/**
@@ -818,7 +818,7 @@ export class ReplayContainer implements ReplayContainerInterface {
818
818
promises . push ( this . _addPerformanceEntries ( ) ) ;
819
819
820
820
// Do not continue if there are no pending events in buffer
821
- if ( ! this . eventBuffer ? .pendingLength ) {
821
+ if ( ! this . eventBuffer || ! this . eventBuffer . pendingLength ) {
822
822
return ;
823
823
}
824
824
@@ -857,7 +857,7 @@ export class ReplayContainer implements ReplayContainerInterface {
857
857
recordingData = await this . eventBuffer . finish ( ) ;
858
858
}
859
859
860
- const sendReplayPromise = sendReplay ( {
860
+ await sendReplay ( {
861
861
replayId,
862
862
recordingData,
863
863
segmentId,
@@ -867,10 +867,6 @@ export class ReplayContainer implements ReplayContainerInterface {
867
867
options : this . getOptions ( ) ,
868
868
timestamp : new Date ( ) . getTime ( ) ,
869
869
} ) ;
870
-
871
- await sendReplayPromise ;
872
-
873
- return ;
874
870
} catch ( err ) {
875
871
this . _handleException ( err ) ;
876
872
0 commit comments