mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
reduce bulk action batch size to 50
This commit is contained in:
parent
0e0c4bddac
commit
6f12b5e406
4 changed files with 7 additions and 5 deletions
|
|
@ -27,6 +27,7 @@ export const bulkAction = async (data: BulkActionData) => {
|
|||
for (let offset = 0; offset < count; offset += batchSize) {
|
||||
const searchArgs = {
|
||||
size: batchSize,
|
||||
includePending: true,
|
||||
query: `(${query}) AND updated:*..${now}`, // only process items that have not been updated
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ export const libraryItemRepository = appDataSource
|
|||
.andWhere('md5(original_url) = md5(:url)', { url })
|
||||
|
||||
if (forUpdate) {
|
||||
qb.setLock('pessimistic_write')
|
||||
qb.setLock('pessimistic_read')
|
||||
}
|
||||
|
||||
return qb.getOne()
|
||||
|
|
|
|||
|
|
@ -760,9 +760,10 @@ export const bulkActionResolver = authorized<
|
|||
},
|
||||
})
|
||||
|
||||
const batchSize = 100
|
||||
const batchSize = 50
|
||||
const searchArgs = {
|
||||
query,
|
||||
includePending: true,
|
||||
size: 0,
|
||||
}
|
||||
const count = await countLibraryItems(searchArgs, uid)
|
||||
|
|
@ -778,13 +779,13 @@ export const bulkActionResolver = authorized<
|
|||
action,
|
||||
count,
|
||||
})
|
||||
// if there are less than 100 items, update them synchronously
|
||||
// if there are less than 50 items, update them synchronously
|
||||
await batchUpdateLibraryItems(action, searchArgs, uid, labelIds, args)
|
||||
|
||||
return { success: true }
|
||||
}
|
||||
|
||||
// if there are more than 100 items, update them asynchronously
|
||||
// if there are more than 50 items, update them asynchronously
|
||||
const data = {
|
||||
userId: uid,
|
||||
action,
|
||||
|
|
|
|||
|
|
@ -1256,7 +1256,7 @@ export const batchUpdateLibraryItems = async (
|
|||
const queryBuilder = getQueryBuilder(userId, em)
|
||||
|
||||
if (forUpdate) {
|
||||
queryBuilder.setLock('pessimistic_write')
|
||||
queryBuilder.setLock('pessimistic_read')
|
||||
}
|
||||
|
||||
const libraryItems = await queryBuilder
|
||||
|
|
|
|||
Loading…
Reference in a new issue