Fix mutex lock missing. (#1214)

This commit is contained in:
Nitromelon 2022-04-14 16:52:04 +08:00 committed by GitHub
parent 3d3daef3c5
commit 6971f84dae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -93,6 +93,7 @@ RedisConnectionPtr RedisClientImpl::newConnection(trantor::EventLoop *loop)
auto loop = trantor::EventLoop::getEventLoopOfCurrentThread();
assert(loop);
loop->runAfter(2.0, [thisPtr, loop, conn]() {
std::lock_guard<std::mutex> lock(thisPtr->connectionsMutex_);
thisPtr->connections_.insert(thisPtr->newConnection(loop));
});
}