From 72f6aa61ddda025a1ce4cc1e6d829c84622a1642 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 30 Oct 2020 10:31:32 +0000 Subject: [PATCH] flush requests queue --- src/CountlyAnalytics.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/CountlyAnalytics.ts b/src/CountlyAnalytics.ts index 3d207d8a4f..6c6ccb8569 100644 --- a/src/CountlyAnalytics.ts +++ b/src/CountlyAnalytics.ts @@ -393,6 +393,11 @@ export default class CountlyAnalytics { if (!this.disabled && this.anonymous === anonymous) return; if (!this.canEnable()) return; + if (!this.disabled) { + // flush request queue as our userKey is going to change, no need to await it + this.request(); + } + const config = SdkConfig.get(); this.baseUrl = new URL("/i", config.countly.url); this.appKey = config.countly.appKey;