Restrucutre transactions to try and debug HASH conflict issue
Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
parent
be92b7db53
commit
fba22f9909
@ -347,6 +347,7 @@ const processBlock = async (items) => {
|
|||||||
asset.duplicate = duplicate.photoId;
|
asset.duplicate = duplicate.photoId;
|
||||||
duplicates.push(asset);
|
duplicates.push(asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
return; /* Done processing this asset (DUPLICATE) */
|
return; /* Done processing this asset (DUPLICATE) */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,13 +382,8 @@ const processBlock = async (items) => {
|
|||||||
transaction: t
|
transaction: t
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
await Promise.mapSeries(insertHash, async (item) => {
|
});
|
||||||
await photoDB.sequelize.query(
|
await photoDB.sequelize.transaction(async (t) => {
|
||||||
"INSERT INTO photohashes (hash,photoId) VALUES(:hash,:id)", {
|
|
||||||
replacements: item,
|
|
||||||
transaction: t
|
|
||||||
});
|
|
||||||
});
|
|
||||||
/* Update the DB with the image information */
|
/* Update the DB with the image information */
|
||||||
await Promise.mapSeries(updateAsset, async (item) => {
|
await Promise.mapSeries(updateAsset, async (item) => {
|
||||||
await photoDB.sequelize.query("UPDATE photos SET " +
|
await photoDB.sequelize.query("UPDATE photos SET " +
|
||||||
@ -398,6 +394,15 @@ const processBlock = async (items) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
await photoDB.sequelize.transaction(async (t) => {
|
||||||
|
await Promise.mapSeries(insertHash, async (item) => {
|
||||||
|
await photoDB.sequelize.query(
|
||||||
|
"INSERT INTO photohashes (hash,photoId) VALUES(:hash,:id)", {
|
||||||
|
replacements: item,
|
||||||
|
transaction: t
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
process.exit(-1);
|
process.exit(-1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user