forked from engineering/cloudservices
Allow clearing of function
parent
bdfbb94ce7
commit
7a38e68048
|
@ -1,7 +1,9 @@
|
|||
import { Client } from '..';
|
||||
|
||||
export default function checkLock(client: Client): void {
|
||||
setInterval(async () => {
|
||||
let interval: NodeJS.Timeout;
|
||||
|
||||
export default function checkLock(client: Client) {
|
||||
interval = setInterval(async () => {
|
||||
try {
|
||||
const moderations = await client.db.Moderation.find();
|
||||
moderations.forEach(async (moderation) => {
|
||||
|
@ -21,4 +23,9 @@ export default function checkLock(client: Client): void {
|
|||
await client.util.handleError(error);
|
||||
}
|
||||
}, 10000);
|
||||
return interval;
|
||||
}
|
||||
|
||||
export function clear() {
|
||||
clearInterval(interval);
|
||||
}
|
||||
|
|
|
@ -3,8 +3,9 @@ import axios from 'axios';
|
|||
import { inspect } from 'util';
|
||||
import { Client } from '..';
|
||||
|
||||
let interval: NodeJS.Timeout;
|
||||
export default function checkSS(client: Client) {
|
||||
setInterval(async () => {
|
||||
interval = setInterval(async () => {
|
||||
try {
|
||||
const accounts = await client.db.Account.find();
|
||||
for (const { userID, homepath, hash } of accounts) {
|
||||
|
@ -33,4 +34,9 @@ export default function checkSS(client: Client) {
|
|||
client.util.handleError(error);
|
||||
}
|
||||
}, 60000);
|
||||
return interval;
|
||||
}
|
||||
|
||||
export function clear() {
|
||||
clearTimeout(interval);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue