mirror of
https://github.com/joyieldInc/predixy.git
synced 2025-12-25 06:56:42 +08:00
force to ping redis when it is failed
This commit is contained in:
parent
c15f54e274
commit
930abec3c3
@ -177,12 +177,21 @@ void ConnectConnectionPool::check()
|
|||||||
if (!mServ->fail() || !mServ->online()) {
|
if (!mServ->fail() || !mServ->online()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
int db = 0;
|
||||||
if (mServ->activate()) {
|
if (mServ->activate()) {
|
||||||
auto c = mShareConns.empty() ? nullptr : mShareConns[0];
|
auto c = mShareConns.empty() ? nullptr : mShareConns[db];
|
||||||
if (!c) {
|
if (!c) {
|
||||||
return;
|
c = ConnectConnectionAlloc::create(mServ, true);
|
||||||
|
c->setDb(db);
|
||||||
|
++mStats.connections;
|
||||||
|
mShareConns[db] = c;
|
||||||
|
logNotice("h %d create server connection %s %d",
|
||||||
|
mHandler->id(), c->peer(), c->fd());
|
||||||
}
|
}
|
||||||
if (c->fd() >= 0) {
|
if (c->fd() >= 0) {
|
||||||
|
// Force share connections to ping redis when redis is failed.
|
||||||
|
RequestPtr req = RequestAlloc::create(Request::PingServ);
|
||||||
|
mHandler->handleRequest(req, c);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
c->reopen();
|
c->reopen();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user