Update cache helper using the wrong symbol to measure interval
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
ad2e4d8f9b
commit
2b04952d85
2 changed files with 12 additions and 4 deletions
|
@ -2,10 +2,10 @@ import { Guild } from "discord.js";
|
|||
import Server from "../database/entities/Server";
|
||||
|
||||
export default class CacheHelper {
|
||||
public static async UpdateServerCache(guild: Guild) {
|
||||
public static async UpdateServerCache(guild: Guild): Promise<boolean> {
|
||||
const cacheInterval = process.env.CACHE_INTERVAL;
|
||||
|
||||
if (!cacheInterval) return;
|
||||
if (!cacheInterval) return false;
|
||||
|
||||
let server = await Server.FetchOneById(Server, guild.id);
|
||||
|
||||
|
@ -14,9 +14,15 @@ export default class CacheHelper {
|
|||
await server.Save(Server, server);
|
||||
|
||||
await CacheHelper.UpdateCache(guild);
|
||||
} else if (server.LastCached.getTime() + Number(cacheInterval) < Date.now()) {
|
||||
|
||||
return true;
|
||||
} else if (server.LastCached.getTime() + Number(cacheInterval) > Date.now()) {
|
||||
await CacheHelper.UpdateCache(guild);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static async UpdateCache(guild: Guild) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue