Skip to content

Commit

Permalink
Reverse the available labors list that the fresh labor be matched fir…
Browse files Browse the repository at this point in the history
…st when distribute.
  • Loading branch information
fool2fish committed May 16, 2014
1 parent 8b1de06 commit 3d13815
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,17 +181,19 @@ module.exports = {

Object.keys(waitingBrowsers).forEach(function(browser) {
var parsedBrowser = parsedBrowsers[browser]
for (var i in availableLabors) {
var labor = availableLabors[i]

Object.keys(availableLabors).reverse().some(function(laborId) {
var labor = availableLabors[laborId]
if (isMatch(parsedBrowser, labor.ua)) {
// browser passed in order.add() cannot be replaced with labor.ua.browser.name
// the browser specified by user may be: ie, ie/8 or windows/ie/8
order.add(labor, browser)
labor.add(order)
break
return true
}
}
})
})

if (!Object.keys(waitingBrowsers).length) {
delete waitingOrders[orderId]
}
Expand Down

0 comments on commit 3d13815

Please sign in to comment.