Fix my little 'ParallelSaveError' bug in Node.js/Mongoose/Sharp.js
$10-30 USD
ที่ทำเสร็จแล้ว
โพสต์ มากกว่า 3 ปีที่ผ่านมา
$10-30 USD
ชำระเงินเมื่อส่งงาน
Hi,
Please fix my bug I receive as follows:
(node:25640) UnhandledPromiseRejectionWarning: ParallelSaveError: Can't save() the same doc multiple times in parallel. Document: 5f60e24e929e1e6428b9204b
[0] at [login to view URL] [as constructor]...
I use [login to view URL] to resize an image many times within a map-function due to criteria from array imgSourceSet and safe each after processing it. Array imgSourceSet comes from MongoDB
imgSourceSet: [
{
_id: 5f5fe01ddffd8425a0bf25c3,
widthSrcSet: 600,
widthResizeCriteria: 650
},
{
_id: 5f5fe079dffd8425a0bf25c4,
widthSrcSet: 250,
widthResizeCriteria: 251
},
{
_id: 5f5fe085dffd8425a0bf25c5,
widthSrcSet: 400,
widthResizeCriteria: 450
},
{
_id: 5f5fe094dffd8425a0bf25c6,
widthSrcSet: 550,
widthResizeCriteria: 551
}
]
Each object (criteria) will be applied for the image with sharp in the map function. See excerpt:
[login to view URL](async (src) => {
if ([login to view URL] > [login to view URL]) {
sharp([login to view URL])
.resize({
width: [login to view URL],
withoutEnlargement: true,
})
.jpeg({ quality: 90, progressive: true, force: false })
.png({
compressionLevel: 9,
progressive: true,
force: false,
})
.webp({ quality: 90, force: false })
.toFile(
`${fileFolder}/${filenam2}-${[login to view URL]}.${ext}`
)
.then(async (info) => {
const image = true;
const imageWidth = [login to view URL];
const imageHeight = [login to view URL];
const sizeByte = [login to view URL];
const slug = `${filenam2}-${[login to view URL]}.${ext}`;
[login to view URL]({
image,
imageWidth,
imageHeight,
sizeByte,
slug,
fileFolder,
});
await [login to view URL]();
//////////////////
Whilst uploading I receive the ParallelSaveError error. After uploading, I see that not all objects in array have been processed and saved. Please fix this bug for me. You can telle me the solution or fix it via anydesk.
Only bid if you have the needed experience. No long lasting try and error for hours.
After providing your solution I will try it and if it works I release the payment. If not, correct it, please.
In case of questions, you can ask me and I can ask you.
NO Scammers and NO bargaining and No Asking for tip after contract approval!
In case of whatever reason, you help me via anydesk.
Only efficient JS solution with the smallest possible performance needs.
No JQuery. No further packages. Don't ask me to send my entire (project-)files.
The issue is related to mongoose save object and has nothing to do with [login to view URL] I've faced the exact same issue before and can resolve this within 15 minutes.
Please provide me your Anydesk ID whenever you want me to start. I can start anytime.
Thanks