Fix deleting many ids
This commit is contained in:
parent
02b61d4ddc
commit
36a36379b4
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue