Wait for auth if status is unauthorized
This commit is contained in:
@@ -130,7 +130,7 @@ export class Connection extends Emitter {
|
|||||||
ensureAuth = async ({timeout = 3000} = {}) => {
|
ensureAuth = async ({timeout = 3000} = {}) => {
|
||||||
await this.ensureConnected()
|
await this.ensureConnected()
|
||||||
|
|
||||||
if (this.meta.authStatus === AuthStatus.Pending) {
|
if ([AuthStatus.Unauthorized, AuthStatus.Pending].includes(this.meta.authStatus)) {
|
||||||
await Promise.race([
|
await Promise.race([
|
||||||
sleep(timeout),
|
sleep(timeout),
|
||||||
new Promise<void>(resolve => {
|
new Promise<void>(resolve => {
|
||||||
|
|||||||
Reference in New Issue
Block a user