How to use the concatLimit function from async

Find comprehensive JavaScript async.concatLimit code examples handpicked from public code repositorys.

30
31
32
33
34
35
36
37
38
39
const getAllUpcomingFacebookEvents = function (user, callback, pages) {
  console.log(`Getting events for ${user}`);
  Facebook.getAllUpcomingFacebookEvents(user, callback, pages);
};

async.concatLimit(sources['facebook'], 1, getAllUpcomingFacebookEvents, function (err, res) {
  if (err) handleError(err, 'fetching facebook events');
  console.log(`${res.length} events downloaded`);
  const facebookEventIds = [];
  const makeRequest = function (facebookEvent, callback) {
fork icon8
star icon3
watch icon7

116
117
118
119
120
121
122
123
124
125
                    { zkPath: zkBucketsPath, error: err.message });
            }
            return next(err, buckets);
        });
},
(buckets, next) => async.concatLimit(
    buckets, this._concurrency,
    (bucket, done) => {
        const [ownerId, bucketUID, bucketName] =
                  bucket.split(':');
fork icon18
star icon0
watch icon1

151
152
153
154
155
156
157
158
159
160
 * @param {Array}   directoryList array of objects: [{device: '...', path: '...'}, ...]
 * @param {Object}  filesMap      object of files: {"relativeFilePath": [..."devicePaths"], ...}
 * @returns {Object} {"relativeFilePath": [..."devicePaths"], ...}
 */
_getFilesMap(directoryList, filesMap, callback) {
  async.concatLimit(
    directoryList,
    IO_CONCURRENT_READ_OPERATION_COUNT,
    (dir, done) => this._traverseDirectory(dir, filesMap, done),
    (err, childrenDirectoryList) => {
fork icon0
star icon2
watch icon2

11
12
13
14
15
16
17
18
19
20
    })
  })
}
async concatLimit(coll, limit, iteratee) {    
  return new Promise(async (resolve, reject) => { 
    async.concatLimit(coll, limit, iteratee, (err, res) => {
      if (err) { 
        reject(err)
      } else {
        resolve(res)
fork icon1
star icon0
watch icon1

+ 21 other calls in file

66
67
68
69
70
71
72
73
74
75
if (req.query.save === 'false') {
  options.save = false
}
scraper.readFeeds(null, options)
  .then(function (feedsRead) {
    async.concatLimit(feedsRead, 10, function (feed, feddCallback) {
      Feeds.create(feed, feddCallback)
    }, function (err, results) {
      if (err) {
        res.status(400).send(err)
fork icon0
star icon0
watch icon2