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!"); }