Skip to content

Commit f22390a

Browse files
committed
address wenxi's comments
1 parent b1b206b commit f22390a

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

packages/core/src/analytics.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -509,12 +509,7 @@ export class SegmentClient {
509509
if (this.enabled.get() === false) {
510510
return;
511511
}
512-
if (!this.running.get()) {
513-
// If not running, queue the event for later processing
514-
await this.store.pendingEvents.add(event);
515-
return event;
516-
}
517-
if (this.isReady.value) {
512+
if (!this.running.get() || !this.isReady.value) {
518513
return this.startTimelineProcessing(event);
519514
} else {
520515
this.store.pendingEvents.add(event);
@@ -532,7 +527,7 @@ export class SegmentClient {
532527
): Promise<SegmentEvent | undefined> {
533528
const event = await this.applyContextData(incomingEvent);
534529
this.flushPolicyExecuter.notify(event);
535-
return await this.timeline.process(event);
530+
return this.timeline.process(event);
536531
}
537532

538533
private async trackDeepLinks() {

packages/core/src/plugins/QueueFlushingPlugin.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,6 @@ export class QueueFlushingPlugin extends UtilityPlugin {
7373
* Calls the onFlush callback with the events in the queue
7474
*/
7575
async flush() {
76-
// Check if event processing is running
77-
const running = this.analytics?.running.get();
78-
if (running === false) {
79-
this.analytics?.logger.info('Event processing is paused, skipping flush');
80-
return;
81-
}
82-
8376
// Wait for the queue to be restored
8477
try {
8578
await this.isRestored;

0 commit comments

Comments
 (0)