Comparing version 2.0.0 to 2.0.1
@@ -13,14 +13,14 @@ "use strict" | ||
} | ||
execute(cb) { | ||
let nowMillis = getNowMillis() | ||
if (this.maxRequestsPerSecond === 0) { | ||
return cb() | ||
return Promise.resolve(cb()) | ||
} else if (nowMillis >= this._nextAvailableRequestMillis) { | ||
this._nextAvailableRequestMillis = getNowMillis() + this._timeBetweenRequestsInMilliSeconds | ||
return cb() | ||
return Promise.resolve(cb()) | ||
} else { | ||
return new Promise((resolve) => { | ||
setTimeout(() => { | ||
resolve(cb) | ||
resolve(cb()) | ||
}, this._nextAvailableRequestMillis - nowMillis) | ||
@@ -27,0 +27,0 @@ this._nextAvailableRequestMillis += this._timeBetweenRequestsInMilliSeconds |
{ | ||
"name": "apac", | ||
"description": "Amazon Product Advertising API Client for Node", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"author": "Dustin McQuay <dmcquay@gmail.com>", | ||
@@ -6,0 +6,0 @@ "scripts": { |
@@ -28,3 +28,3 @@ "use strict" | ||
awsSecret: config.AWS_SECRET_ACCESS_KEY, | ||
assocId: config.AWS_ASSOCIATE_ID | ||
assocId: config.AWS_ASSOCIATE_ID | ||
}) | ||
@@ -43,6 +43,6 @@ | ||
expect(result.ItemSearchResponse).to.exist | ||
expect(result.ItemSearchResponse.Items.length).to.equal(1) | ||
expect(result.ItemSearchResponse.Items[0].Item[0].ItemAttributes[0].Author[0]).to.equal('J.K. Rowling') | ||
expect(result.ItemSearchResponse.Items.Item.length).to.be.at.least(1) | ||
expect(result.ItemSearchResponse.Items.Item[0].ItemAttributes.Author[0]).to.equal('J.K. Rowling') | ||
}) | ||
}) | ||
}) | ||
}) |
37627
737