Chunked duplicate check to prevent postgres stack depth errors.

This commit is contained in:
DebaucheryLibrarian
2022-01-10 02:17:17 +01:00
parent 43a0bc8a2c
commit 506971b44b
3 changed files with 33 additions and 22 deletions

View File

@@ -232,7 +232,7 @@ function actors(release) {
}
async function fetchLatest(entity, page, options) {
return Promise.all(Array.from({ length: 100 }, async (value, index) => {
return Promise.all(Array.from({ length: 10000 }, async (value, index) => {
const release = {};
release.entryId = nanoid();
@@ -262,7 +262,7 @@ async function fetchLatest(entity, page, options) {
.select('name')
.where('priority', '>', 7)
.orderByRaw('random()')
.limit(faker.random.number({ min: 2, max: 15 }))
.limit(faker.datatype.number({ min: 2, max: 15 }))
.pluck('name');
release.actors = [...actors(release), null]; // include empty actor to ensure proper handling