MCPcopy Create free account
hub / github.com/apache/kvrocks / AdjustWorkerThreads

Method AdjustWorkerThreads

src/server/server.cc:2052–2068  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2050}
2051
2052void Server::AdjustWorkerThreads() {
2053 auto new_worker_threads = static_cast<size_t>(config_->workers);
2054 if (new_worker_threads == worker_threads_.size()) {
2055 return;
2056 }
2057 size_t delta = 0;
2058 if (new_worker_threads > worker_threads_.size()) {
2059 delta = new_worker_threads - worker_threads_.size();
2060 increaseWorkerThreads(delta);
2061 INFO("[server] Increase worker threads from {} to {}", worker_threads_.size(), new_worker_threads);
2062 return;
2063 }
2064
2065 delta = worker_threads_.size() - new_worker_threads;
2066 INFO("[server] Decrease worker threads from {} to {}", worker_threads_.size(), new_worker_threads);
2067 decreaseWorkerThreads(delta);
2068}
2069
2070void Server::increaseWorkerThreads(size_t delta) {
2071 for (size_t i = 0; i < delta; i++) {

Callers 1

initFieldCallbackMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected