Skip to content

Commit

Permalink
fix: avoid benching already benched proxy.
Browse files Browse the repository at this point in the history
  • Loading branch information
drallieiv committed May 23, 2017
1 parent de18df1 commit a047418
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,16 @@ public synchronized Optional<ProxySlot> getEligibleProxy() {
}

public void benchProxy(ProxyInfo proxy) {
proxies.remove(proxy);
proxyBench.add(proxy);
logger.warn("Proxy [{}] moved out of rotation, {} proxy left",proxy, proxies.size());

if(recycler != null && getNbProxyInRotation() == 0){
recycler.setFastMode(true);
recycler.checkAndRecycleAllBenched();
if(proxies.contains(proxy) && !proxyBench.contains(proxy)){
proxies.remove(proxy);
proxyBench.add(proxy);
logger.warn("Proxy [{}] moved out of rotation, {} proxy left",proxy, proxies.size());

if(recycler != null && getNbProxyInRotation() == 0){
recycler.setFastMode(true);
recycler.checkAndRecycleAllBenched();
}
}

}

public int getNbProxyInRotation(){
Expand Down

0 comments on commit a047418

Please sign in to comment.