diff --git a/src/intervals/autoRelease.ts b/src/intervals/autoRelease.ts index fca216c..2924707 100644 --- a/src/intervals/autoRelease.ts +++ b/src/intervals/autoRelease.ts @@ -6,8 +6,8 @@ import { CloudServicesUtil } from '../util'; let interval: NodeJS.Timeout; -export default function checkLock(client: Client): NodeJS.Timeout { - interval = setInterval(async () => { +export default async function checkLock(client: Client) { + async function start() { try { const moderations = await client.db.Moderation.find(); const judgements = await client.db.Judgement.find().lean().exec(); @@ -59,6 +59,10 @@ export default function checkLock(client: Client): NodeJS.Timeout { } catch (error) { await client.util.handleError(error); } + } + await start(); + interval = setInterval(async () => { + await start(); }, 10000); return interval; }