Upgrade amplitude stripe amazon-payments cwait (#9962)

* upgrade amplitude stripe amazon-payments cwait

* correctly import cwait
This commit is contained in:
Matteo Pagliazzi
2018-02-09 13:47:52 +01:00
committed by GitHub
parent f947d3562b
commit 1ed58c452c
3 changed files with 34 additions and 228 deletions

View File

@@ -12,7 +12,7 @@ import { removeFromArray } from '../libs/collectionManipulators';
import shared from '../../common';
import { sendTxn as txnEmail } from '../libs/email';
import { sendNotification as sendPushNotification } from '../libs/pushNotifications';
import cwait from 'cwait';
import { TaskQueue } from 'cwait';
import { syncableAttrs, setNextDue } from '../libs/taskManager';
const Schema = mongoose.Schema;
@@ -211,7 +211,7 @@ schema.methods.addTasks = async function challengeAddTasks (tasks) {
let challenge = this;
let membersIds = await _fetchMembersIds(challenge._id);
let queue = new cwait.TaskQueue(Bluebird, 25); // process only 5 users concurrently
let queue = new TaskQueue(Bluebird, 25); // process only 5 users concurrently
await Bluebird.map(membersIds, queue.wrap((memberId) => {
return _addTaskFn(challenge, tasks, memberId);