Skip to content

Commit

Permalink
Fix guild members not arriving in time on multiple instances.
Browse files Browse the repository at this point in the history
  • Loading branch information
IceeMC committed Mar 2, 2022
1 parent e7d94e5 commit 0b3137f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Util/Services/discord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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");
}

});
Expand Down
1 change: 0 additions & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ new Promise<void>((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!");
}

Expand Down

0 comments on commit 0b3137f

Please sign in to comment.