mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 02:48:59 -04:00
thread_pool: measure cooldown from completion in _maybe_grow_on_pressure
The monitor stores _last_scale_time_usecs after _add_thread_scaling_locked returns (i.e. after pthread_create), but _maybe_grow_on_pressure stored a timestamp captured before the add. Under resource pressure pthread_create can take non-trivial time, making the effective cooldown shorter than configured on the fast-path grow. Move the store after _add_thread_scaling_locked and use a fresh _now_usecs() call, matching the monitor's behavior. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
159a5c7b71
commit
375f1f9303
1 changed files with 1 additions and 2 deletions
|
|
@ -806,9 +806,8 @@ ThreadPool::_maybe_grow_on_pressure()
|
|||
if(count >= _scaling_config.max_threads)
|
||||
return;
|
||||
|
||||
_last_scale_time_usecs.store(now,std::memory_order_relaxed);
|
||||
|
||||
_add_thread_scaling_locked({});
|
||||
_last_scale_time_usecs.store(_now_usecs(),std::memory_order_relaxed);
|
||||
syslog(LOG_DEBUG,
|
||||
"threadpool (%s): fast-path grow to %zu threads (queue full)",
|
||||
_name.c_str(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue