mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-10 18:05:44 +02:00
fix: small races on config registry and maxclients (#2078)
* fix small data race with maxclients * make config::set an atomic operation
This commit is contained in:
parent
b403416be0
commit
7b71b728c7
3 changed files with 4 additions and 4 deletions
|
@ -25,7 +25,6 @@ auto ConfigRegistry::Set(std::string_view config_name, std::string_view value) -
|
|||
return SetResult::READONLY;
|
||||
|
||||
auto cb = it->second.cb;
|
||||
lk.unlock();
|
||||
|
||||
absl::CommandLineFlag* flag = absl::FindCommandLineFlag(config_name);
|
||||
CHECK(flag);
|
||||
|
|
|
@ -439,8 +439,6 @@ bool RunEngine(ProactorPool* pool, AcceptServer* acceptor) {
|
|||
}
|
||||
}
|
||||
|
||||
service.Init(acceptor, listeners, opts);
|
||||
|
||||
if (!tcp_disabled) {
|
||||
error_code ec = acceptor->AddListener(bind_addr, port, main_listener);
|
||||
|
||||
|
@ -458,6 +456,8 @@ bool RunEngine(ProactorPool* pool, AcceptServer* acceptor) {
|
|||
acceptor->AddListener(mc_port, new Listener{Protocol::MEMCACHE, &service});
|
||||
}
|
||||
|
||||
service.Init(acceptor, listeners, opts);
|
||||
|
||||
VersionMonitor version_monitor;
|
||||
version_monitor.Run(pool);
|
||||
|
||||
|
|
|
@ -472,7 +472,8 @@ ServerFamily::~ServerFamily() {
|
|||
void SetMaxClients(std::vector<facade::Listener*>& listeners, uint32_t maxclients) {
|
||||
for (auto* listener : listeners) {
|
||||
if (!listener->IsPrivilegedInterface()) {
|
||||
listener->SetMaxClients(maxclients);
|
||||
listener->socket()->proactor()->Await(
|
||||
[listener, maxclients]() { listener->SetMaxClients(maxclients); });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue