Fix deleting many ids

This commit is contained in:
Chocobozzz 2023-08-07 07:49:14 +02:00
parent 02b61d4ddc
commit 36a36379b4
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 3 additions and 3 deletions

View File

@ -7,7 +7,8 @@ import { logger } from '../../helpers/logger'
async function removeNotExistingIdsFromHost (indexName: string, host: string, existingIds: Set<number>) { async function removeNotExistingIdsFromHost (indexName: string, host: string, existingIds: Set<number>) {
const idsFromDB = await getIdsOf(indexName, host) const idsFromDB = await getIdsOf(indexName, host)
const idsToRemove = difference(idsFromDB, Array.from(existingIds)) // Elastic Search limits max terms amount
const idsToRemove = difference(idsFromDB, Array.from(existingIds)).splice(0, 50000)
logger.info({ idsToRemove }, 'Will remove %d entries from %s of host %s.', idsToRemove.length, indexName, host) logger.info({ idsToRemove }, 'Will remove %d entries from %s of host %s.', idsToRemove.length, indexName, host)

View File

@ -414,7 +414,6 @@ function formatVideoForDB (v: IndexableVideo | IndexableVideoDetails): DBVideo |
previewPath: v.previewPath, previewPath: v.previewPath,
embedPath: v.embedPath, embedPath: v.embedPath,
views: v.views, views: v.views,
viewers: v.viewers, viewers: v.viewers,
likes: v.likes, likes: v.likes,
@ -445,7 +444,7 @@ function formatVideoForDB (v: IndexableVideo | IndexableVideoDetails): DBVideo |
support: v.support, support: v.support,
commentsEnabled: v.commentsEnabled, commentsEnabled: v.commentsEnabled,
downloadEnabled: v.downloadEnabled, downloadEnabled: v.downloadEnabled
} }
} }