mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
fix: export all items job stuck
This commit is contained in:
parent
201a5817ef
commit
a77ade0890
2 changed files with 10 additions and 6 deletions
|
|
@ -50,9 +50,9 @@ export const exportAllItems = async (jobData: ExportAllItemsJobData) => {
|
|||
|
||||
const maxItems = 100
|
||||
const limit = 10
|
||||
let offset = 0
|
||||
let exported = 0
|
||||
// get max 100 most recent items from the database
|
||||
while (offset < maxItems) {
|
||||
for (let offset = 0; offset < maxItems; offset += limit) {
|
||||
const libraryItems = await findRecentLibraryItems(userId, limit, offset)
|
||||
if (libraryItems.length === 0) {
|
||||
logger.info('no library items found', {
|
||||
|
|
@ -92,17 +92,17 @@ export const exportAllItems = async (jobData: ExportAllItemsJobData) => {
|
|||
updated,
|
||||
})
|
||||
|
||||
offset += libraryItems.length
|
||||
exported += libraryItems.length
|
||||
|
||||
logger.info('exported items', {
|
||||
...jobData,
|
||||
offset,
|
||||
exported,
|
||||
})
|
||||
}
|
||||
|
||||
logger.info('exported all items', {
|
||||
...jobData,
|
||||
offset,
|
||||
exported,
|
||||
})
|
||||
|
||||
// clear task name in integration
|
||||
|
|
|
|||
|
|
@ -1216,7 +1216,11 @@ export const batchUpdateLibraryItems = async (
|
|||
|
||||
await authTrx(
|
||||
async (tx) =>
|
||||
getQueryBuilder(userId, tx).update(LibraryItem).set(values).execute(),
|
||||
getQueryBuilder(userId, tx)
|
||||
.take(searchArgs.size)
|
||||
.update(LibraryItem)
|
||||
.set(values)
|
||||
.execute(),
|
||||
undefined,
|
||||
userId
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue