From 931eb7219a320e890b9b18828c1af581d3c9557a Mon Sep 17 00:00:00 2001 From: Will Hunt <will@half-shot.uk> Date: Wed, 1 May 2019 16:40:20 +0100 Subject: [PATCH] Don't block on destroy --- src/clientfactory.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/clientfactory.ts b/src/clientfactory.ts index ff1f086..bd76fe5 100644 --- a/src/clientfactory.ts +++ b/src/clientfactory.ts @@ -65,11 +65,9 @@ export class DiscordClientFactory { await client.login(token); const id = client.user.id; - try { - await client.destroy(); - } catch (err) { - log.warn("Failed to destroy client ", id); - } + + // This can be done asynchronously, because we don't need to block to return the id. + client.destroy().catch((err) => { log.warn("Failed to destroy client ", id); }); return id; -- GitLab