Copy items across libraries in batches of 100
This will hopefully fix failures when copying huge numbers of items.
This commit is contained in:
parent
0cb683ab18
commit
f4ac511b50
1 changed files with 15 additions and 9 deletions
|
@ -2169,16 +2169,22 @@ Zotero.CollectionTreeView.prototype.drop = Zotero.Promise.coroutine(function* (r
|
||||||
if (!sameLibrary) {
|
if (!sameLibrary) {
|
||||||
let toReconcile = [];
|
let toReconcile = [];
|
||||||
|
|
||||||
yield Zotero.DB.executeTransaction(function* () {
|
yield Zotero.Utilities.Internal.forEachChunkAsync(
|
||||||
for (let item of newItems) {
|
newItems,
|
||||||
var id = yield copyItem(item, targetLibraryID, copyOptions)
|
100,
|
||||||
// Standalone attachments might not get copied
|
function (chunk) {
|
||||||
if (!id) {
|
return Zotero.DB.executeTransaction(async function () {
|
||||||
continue;
|
for (let item of chunk) {
|
||||||
}
|
var id = await copyItem(item, targetLibraryID, copyOptions)
|
||||||
newIDs.push(id);
|
// Standalone attachments might not get copied
|
||||||
|
if (!id) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
newIDs.push(id);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
);
|
||||||
|
|
||||||
if (toReconcile.length) {
|
if (toReconcile.length) {
|
||||||
let sourceName = Zotero.Libraries.getName(items[0].libraryID);
|
let sourceName = Zotero.Libraries.getName(items[0].libraryID);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue