Skip to content

Commit

Permalink
allow passing concurrency limit
Browse files Browse the repository at this point in the history
  • Loading branch information
blainsmith committed Jun 8, 2017
1 parent 62dcb82 commit fa58212
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ exports.initialize = options => {
const clientId = options.clientId;
const clientSecret = options.clientSecret;
const accountId = options.accountId;
const concurrentRequestLimit = options.concurrentRequestLimit;
const role = 'provider';
const cmd = 'get';

Expand All @@ -38,7 +39,7 @@ exports.initialize = options => {
const collectionTransform = options.collectionTransform;
const videoTransform = options.videoTransform;

const client = new Client({bus, clientId, clientSecret, accountId});
const client = new Client({bus, clientId, clientSecret, accountId, concurrentRequestLimit});

const getChannel = createChannelCache(bus);

Expand Down Expand Up @@ -120,6 +121,7 @@ exports.createClient = options => {
const clientId = options.clientId;
const clientSecret = options.clientSecret;
const accountId = options.accountId;
const concurrentRequestLimit = options.concurrentRequestLimit;

if (!clientId || typeof clientId !== 'string') {
throw new Error(
Expand All @@ -139,5 +141,5 @@ exports.createClient = options => {
);
}

return new Client({bus, clientId, clientSecret, accountId});
return new Client({bus, clientId, clientSecret, accountId, concurrentRequestLimit});
};
10 changes: 7 additions & 3 deletions test/initialize-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ const helpers = require('./helpers');
const clientId = 'fake-client-id';
const clientSecret = 'fake-client-secret';
const accountId = 'fake-account-id';
const concurrentRequestLimit = 13;

let bus;
let options;
let result = null;

let createVideoHandlerSpy;
Expand All @@ -29,11 +31,12 @@ test.before(() => {
createPlaylistHandlerSpy = sinon.stub(provider, 'createPlaylistHandler').returns(playlistHandler);
queryHandlerSpy = sinon.spy(bus, 'queryHandler');

const options = {
options = {
bus,
clientId,
clientSecret,
accountId
accountId,
concurrentRequestLimit
};

return provider.initialize(options).then(res => {
Expand All @@ -43,12 +46,13 @@ test.before(() => {
});

test('creates Brightcove client', t => {
t.plan(4);
t.plan(5);

t.truthy(result.client);
t.is(result.client.clientId, clientId);
t.is(result.client.clientSecret, clientSecret);
t.is(result.client.accountId, accountId);
t.is(result.client.concurrentRequestLimit, concurrentRequestLimit);
});

test('calls createVideoHandler', t => {
Expand Down

0 comments on commit fa58212

Please sign in to comment.