[cards] make them a smaller burden

This commit is contained in:
Avris 2021-07-14 16:39:46 +02:00
parent acc452540c
commit 463d707948
2 changed files with 4 additions and 3 deletions

View File

@ -21,18 +21,19 @@ const modes = ['light', 'dark'];
(async () => {
const db = await dbConnection();
while (true) {
await sleep(5000);
const profiles = (await db.all(`
SELECT profiles.id, profiles.locale, users.username
FROM profiles
LEFT JOIN users on profiles.userId = users.id
WHERE profiles.card IS NULL
ORDER BY RANDOM()
LIMIT 8
LIMIT 6
`)).filter(({locale}) => !isHighLoadTime(locale));
if (profiles.length === 0) {
console.log('No profiles in the queue');
await sleep(5000);
continue;
}

View File

@ -1,5 +1,5 @@
const overloadPeriods = {
en: [[16, 23]],
en: [[15, 24]],
};
module.exports = (locale, timestamp = new Date) => {