mirror of
https://github.com/zoriya/Kyoo.git
synced 2026-03-15 22:23:48 -04:00
Fix pg pool starvation (#1205)
This commit is contained in:
parent
58603c5180
commit
fc7deb8e09
@ -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;
|
||||
}
|
||||
|
||||
@ -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(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user