From 0b3137fe706380685e96d9a04d027796723d6e55 Mon Sep 17 00:00:00 2001 From: IceeMC Date: Wed, 2 Mar 2022 15:20:51 -0800 Subject: [PATCH] Fix guild members not arriving in time on multiple instances. --- src/Util/Services/discord.ts | 4 +++- src/app.ts | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Util/Services/discord.ts b/src/Util/Services/discord.ts index 04b5ff00..c1b0e717 100644 --- a/src/Util/Services/discord.ts +++ b/src/Util/Services/discord.ts @@ -67,7 +67,8 @@ bot.on("ready", async () => { await uploadStatuses(); const lock = await global.redis.get("fetch_lock"); - if (lock != hostname()) { + + if (lock && lock != hostname()) { console.log(`Skipping discord caching. The instance which holds the lock is: ${lock}`); } else { console.time("Bot cache"); @@ -81,6 +82,7 @@ bot.on("ready", async () => { .catch(() => null); // It is most likely that DEL has another instance running to handle this, so catch the error and ignore. }); console.timeEnd("Bot cache"); + await global.redis.del("fetch_lock"); } }); diff --git a/src/app.ts b/src/app.ts index 992b3c61..dd3dd961 100644 --- a/src/app.ts +++ b/src/app.ts @@ -219,7 +219,6 @@ new Promise((resolve, reject) => { console.timeEnd("Bot stats update"); await global.redis.publish("cache_lock", "ready"); await global.redis.del("cache_lock"); - await global.redis.del("fetch_lock"); console.log("Dropped cache lock!"); }