Skip to content
This repository has been archived by the owner on Jun 6, 2019. It is now read-only.

Commit

Permalink
attempt at fixing race resulting in multiple in flight (#34)
Browse files Browse the repository at this point in the history
LGTM.
  • Loading branch information
evq authored and mrose17 committed Dec 18, 2017
1 parent 220d0c0 commit be9a300
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -703,11 +703,14 @@ Client.prototype._publishersInfo = function (callback) {

if (!publisher) return

self.publishers = underscore.rest(self.publishers)
const remaining = underscore.rest(self.publishers)
self.publishers = remaining
self.publisherInfo(publisher, (err, result) => { callback(err, result || { publisher: publisher }) })

setTimeout(() => self._publishersInfo.bind(self)(callback),
random.randomInt({ min: 1, max: (this.options.debugP ? 1 : 250) }))
if (remaining.length > 0) {
setTimeout(() => self._publishersInfo.bind(self)(callback),
random.randomInt({ min: 1, max: (this.options.debugP ? 1 : 250) }))
}
}

Client.prototype.getPromotion = function (lang, forPaymentId, callback) {
Expand Down

0 comments on commit be9a300

Please sign in to comment.