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