mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-24 21:46:22 -04:00
[profile] #290 generic rel=me (links table) - random order (useful when multiple workers)
This commit is contained in:
parent
0b36781037
commit
3edea8c214
@ -10,7 +10,7 @@ const timer = ms => new Promise( res => setTimeout(res, ms));
|
||||
const analyser = new LinkAnalyser();
|
||||
const db = await dbConnection();
|
||||
while (true) {
|
||||
const chunk = await db.all(SQL`SELECT url FROM links WHERE (expiresAt IS NULL OR expiresAt <= ${new Date() / 1000}) LIMIT 64`);
|
||||
const chunk = await db.all(SQL`SELECT url FROM links WHERE (expiresAt IS NULL OR expiresAt <= ${new Date() / 1000}) ORDER BY RANDOM() LIMIT 64`);
|
||||
console.log(`Fetching ${chunk.length} links: (${chunk.map(l => l.url).join(', ')})`);
|
||||
if (chunk.length === 0) {
|
||||
await timer(1000);
|
||||
|
Loading…
x
Reference in New Issue
Block a user