projects
/
metaproxy-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
98db99f
)
Fix load_balance: does not retry dead target MP-626
author
Adam Dickmeiss
<adam@indexdata.dk>
Tue, 25 Aug 2015 12:01:51 +0000
(14:01 +0200)
committer
Adam Dickmeiss
<adam@indexdata.dk>
Tue, 25 Aug 2015 12:01:58 +0000
(14:01 +0200)
src/filter_load_balance.cpp
patch
|
blob
|
history
diff --git
a/src/filter_load_balance.cpp
b/src/filter_load_balance.cpp
index
dafe8f3
..
1ad761c
100644
(file)
--- a/
src/filter_load_balance.cpp
+++ b/
src/filter_load_balance.cpp
@@
-150,8
+150,8
@@
void yf::LoadBalance::Impl::process(mp::Package &package)
// they turn out to be bad..
while (1)
{
// they turn out to be bad..
while (1)
{
- std::string target;
std::list<std::string>::iterator ivh = vhosts.begin();
std::list<std::string>::iterator ivh = vhosts.begin();
+ std::list<std::string>::iterator ivh_pick = vhosts.end();
Package init_pkg(package.session(), package.origin());
init_pkg.copy_filter(package);
Package init_pkg(package.session(), package.origin());
init_pkg.copy_filter(package);
@@
-160,7
+160,7
@@
void yf::LoadBalance::Impl::process(mp::Package &package)
{
boost::mutex::scoped_lock scoped_lock(m_mutex);
{
boost::mutex::scoped_lock scoped_lock(m_mutex);
- for (; ivh != vhosts.end(); )
+ for (; ivh != vhosts.end(); ivh++)
{
if ((*ivh).size() != 0)
{
{
if ((*ivh).size() != 0)
{
@@
-170,21
+170,17
@@
void yf::LoadBalance::Impl::process(mp::Package &package)
(*ivh).c_str(), cost, vhcost);
if (cost > vhcost)
{
(*ivh).c_str(), cost, vhcost);
if (cost > vhcost)
{
+ ivh_pick = ivh;
cost = vhcost;
cost = vhcost;
- target = *ivh;
- ivh = vhosts.erase(ivh);
}
}
- else
- ivh++;
}
}
- else
- ivh++;
}
}
}
}
- if (target.length() == 0)
+ if (ivh_pick == vhosts.end())
break;
break;
+ std::string target = *ivh_pick;
+ vhosts.erase(ivh_pick);
// copying new target into init package
// copying new target into init package
-
yazpp_1::GDU init_gdu(base_req);
Z_InitRequest *init_req = init_gdu.get()->u.z3950->u.initRequest;
yazpp_1::GDU init_gdu(base_req);
Z_InitRequest *init_req = init_gdu.get()->u.z3950->u.initRequest;