File tree 6 files changed +16
-8
lines changed
packages/optimizely-sdk/lib 6 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -67,8 +67,9 @@ export class SingleEventQueue<K> implements EventQueue<K> {
67
67
this . sink = sink
68
68
}
69
69
70
- start ( ) : void {
70
+ start ( ) : Promise < any > {
71
71
// no-op
72
+ return Promise . resolve ( )
72
73
}
73
74
74
75
stop ( ) : Promise < any > {
@@ -114,9 +115,11 @@ export class DefaultEventQueue<K> implements EventQueue<K> {
114
115
this . started = false
115
116
}
116
117
117
- start ( ) : void {
118
+ start ( ) : Promise < any > {
118
119
this . started = true
119
120
// dont start the timer until the first event is enqueued
121
+
122
+ return Promise . resolve ( ) ;
120
123
}
121
124
122
125
stop ( ) : Promise < any > {
Original file line number Diff line number Diff line change 14
14
* limitations under the License.
15
15
*/
16
16
export interface Managed {
17
- start ( ) : void
17
+ start ( ) : Promise < any >
18
18
19
19
stop ( ) : Promise < any >
20
20
}
Original file line number Diff line number Diff line change @@ -205,7 +205,7 @@ export class LogTierV1EventProcessor implements EventProcessor {
205
205
}
206
206
207
207
public async start ( ) : Promise < void > {
208
- this . queue . start ( )
208
+ await this . queue . start ( )
209
209
this . unsubscribeNetInfo = addConnectionListener ( this . connectionListener . bind ( this ) )
210
210
211
211
await this . processPendingEvents ( )
Original file line number Diff line number Diff line change @@ -97,6 +97,6 @@ export class LogTierV1EventProcessor implements EventProcessor {
97
97
}
98
98
99
99
async start ( ) : Promise < void > {
100
- this . queue . start ( )
100
+ await this . queue . start ( )
101
101
}
102
102
}
Original file line number Diff line number Diff line change @@ -179,12 +179,15 @@ export default class Optimizely implements Client {
179
179
180
180
const eventProcessorStartedPromise = this . eventProcessor . start ( ) ;
181
181
182
- const dependentPromises : Array < Promise < any > | void > = [
182
+ const dependentPromises : Array < Promise < any > > = [
183
183
projectConfigManagerReadyPromise ,
184
184
eventProcessorStartedPromise ,
185
- config . odpManager ?. initPromise ,
186
185
] ;
187
186
187
+ if ( config . odpManager ?. initPromise ) {
188
+ dependentPromises . push ( config . odpManager . initPromise ) ;
189
+ }
190
+
188
191
this . readyPromise = Promise . all ( dependentPromises ) . then ( promiseResults => {
189
192
// If no odpManager exists yet, creates a new one
190
193
if ( config . odpManager != null ) {
Original file line number Diff line number Diff line change @@ -44,7 +44,9 @@ class ForwardingEventProcessor implements EventProcessor {
44
44
}
45
45
}
46
46
47
- start ( ) : void { }
47
+ start ( ) : Promise < any > {
48
+ return Promise . resolve ( ) ;
49
+ }
48
50
49
51
stop ( ) : Promise < unknown > {
50
52
return Promise . resolve ( ) ;
You can’t perform that action at this time.
0 commit comments