Fix pg pool starvation (#1205)

This commit is contained in:
Zoe Roux 2025-12-07 14:40:44 +01:00 committed by GitHub
parent 58603c5180
commit fc7deb8e09
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 5 deletions

View File

@ -100,7 +100,11 @@ export const processImages = record("processImages", async () => {
let found = true;
while (found) {
found = await processOne();
// run 10 downloads at the same time,
// if one of them couldn't find an item the queue is empty.
found = !(
await Promise.all([new Array(10)].map(() => processOne()))
).includes(false);
}
running = false;
}

View File

@ -7,10 +7,7 @@ import { comment } from "./utils";
await migrate();
// run image processor task in background
for (let i = 0; i < 10; i++) {
processImages();
}
processImages();
const app = new Elysia()
.use(