This commit is contained in:
邹金海 2024-01-31 12:50:00 +08:00 committed by GitHub
commit 0abbb0bede
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -49,14 +49,16 @@ Server* ServerGroup::getServer(Handler* h, Request* req) const
Server* serv = nullptr;
if (req->requireWrite()) {
int cnt = mServs.size();
for (int i = 0; i < cnt; ++i) {
for (int i = cnt-1; i >= 0; --i) {
Server* s = mServs[i];
if (!s->online()) {
continue;
}
if (s->role() == Server::Master) {
serv = s;
break;
if (!s->fail()){
break;
}
}
}
} else if (auto dataCenter = mPool->proxy()->dataCenter()) {