-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmailchimp.js
39 lines (32 loc) · 926 Bytes
/
mailchimp.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
'use strict';
var Manager = require('../manager.js');
var _ = require('lodash');
/**
* Quota Preset for MailChimp
*
* Quota rules based on: http://kb.mailchimp.com/api/article/about-connectivity-and-timeouts
* MailChimp API docs: http://kb.mailchimp.com/api
*
* In a cluster environment a local Server can be used if all requests on
* behalf a particular user are only made by a single node.js instance.
*
* @param options
* @returns {Manager}
*/
module.exports = function (options) {
_.defaults(options, {
concurrentRequests: 10
});
var manager = new Manager({
//backoff: 'timeout'
});
// Each user account is permitted up to 10 simultaneous connections
manager.addRule({
limit: options.concurrentRequests,
throttling: 'limit-concurrency',
queueing: 'fifo',
scope: 'userId',
resource: 'requests'
});
return manager;
};