getCodeFromS3(s3DownloadClient, sourceBucket.key)
.then(unzipCode)
.then((filelist) => {
return Promise.all([filelist, putObjects(filelist, s3UploadClient)]);
})
.then(putJobSuccess)
.catch((err) => {
putJobFailure(err);
});
The above lambda function returns error "EMFILE, too many open files". The error is coming while unzipping the files. How can I fix it in aws console?
One simple way to throttle requests that consume too many file handles or sockets is to use bottleneck .
For example:
const Bottleneck = require('bottleneck');
const limiter = new Bottleneck({
// minTime: 33,
maxConcurrent: 100,
});
const func = async (value) => {
// do something, returns promise
};
const values = [...];
const wrapped_func = limiter.wrap(func);
const rc = await Promise.all(values.map(wrapped_func));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.