diff --git a/sdk/src/driftClient.ts b/sdk/src/driftClient.ts index 29abf5d2f..2df2efc25 100644 --- a/sdk/src/driftClient.ts +++ b/sdk/src/driftClient.ts @@ -776,16 +776,23 @@ export class DriftClient { accountSubscription: this.userStatsAccountSubscriptionConfig, }); - await this.userStats.subscribe(); + const subscriptionPromises: Promise[] = [this.userStats.subscribe()]; + let success = true; if (this.isSubscribed) { - await Promise.all(this.unsubscribeUsers()); - this.users.clear(); - success = await this.addAndSubscribeToUsers(); + const reSubscribeUsersPromise = async () => { + await Promise.all(this.unsubscribeUsers()); + this.users.clear(); + success = await this.addAndSubscribeToUsers(); + }; + + subscriptionPromises.push(reSubscribeUsersPromise()); } + await Promise.all(subscriptionPromises); + return success; }