1
- import {
2
- AggregationCounts ,
3
- RequestSessionStatus ,
4
- SessionAggregates ,
5
- SessionFlusherLike ,
6
- Transport ,
7
- } from '@sentry/types' ;
1
+ import { AggregationCounts , Client , RequestSessionStatus , SessionAggregates , SessionFlusherLike } from '@sentry/types' ;
8
2
import { dropUndefinedKeys , logger } from '@sentry/utils' ;
9
3
10
4
import { IS_DEBUG_BUILD } from './flags' ;
@@ -24,22 +18,18 @@ export class SessionFlusher implements SessionFlusherLike {
24
18
private _sessionAttrs : ReleaseHealthAttributes ;
25
19
private _intervalId : ReturnType < typeof setInterval > ;
26
20
private _isEnabled : boolean = true ;
27
- private _transport : Transport ;
21
+ private _client : Client ;
28
22
29
- public constructor ( transport : Transport , attrs : ReleaseHealthAttributes ) {
30
- this . _transport = transport ;
23
+ public constructor ( client : Client , attrs : ReleaseHealthAttributes ) {
24
+ this . _client = client ;
31
25
// Call to setInterval, so that flush is called every 60 seconds
32
26
this . _intervalId = setInterval ( ( ) => this . flush ( ) , this . flushTimeout * 1000 ) ;
33
27
this . _sessionAttrs = attrs ;
34
28
}
35
29
36
30
/** Sends session aggregates to Transport */
37
31
public sendSessionAggregates ( sessionAggregates : SessionAggregates ) : void {
38
- if ( ! this . _transport . sendSession ) {
39
- IS_DEBUG_BUILD && logger . warn ( "Dropping session because custom transport doesn't implement sendSession" ) ;
40
- return ;
41
- }
42
- void this . _transport . sendSession ( sessionAggregates ) . then ( null , reason => {
32
+ void this . _client . sendSession ( sessionAggregates ) . then ( null , reason => {
43
33
IS_DEBUG_BUILD && logger . error ( 'Error while sending session:' , reason ) ;
44
34
} ) ;
45
35
}
0 commit comments