From a7759abeee4cb526541ea224c4448072ce506cd4 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Thu, 3 Feb 2022 14:58:59 -0500 Subject: [PATCH] fix x2 autorelease interval --- src/intervals/autoRelease.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; }