perf(daemon): memoize the external debug.log miss

When following the debug.log of a node this session did not launch, every
poll re-read the last 2 MB of the file and re-scanned it for the process
banner. If that node logs to its console instead, the banner is never
there, so the full re-scan repeated on every poll for the life of the
process.

- A miss is now remembered by pid and file size: if nothing has changed
  since the last miss, or the file is growing but the backoff has not
  elapsed, the scan is skipped.
- The retry schedule re-scans quickly during a fresh-node grace window
  (the banner flushes a beat after the pid appears) and then backs off
  from 4 s, doubling to a 60 s cap. The memo is cleared on a successful
  tie and when the followed process goes away.

Tests: the retry delay is fast within the grace window and then steps
4, 8, 16 s up to the 60 s cap.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-10-13 17:42:30 -05:00
co-authored by Claude Opus 4.8
parent 1cd4ea4026
commit 2c9e99c022
4 changed files with 52 additions and 1 deletions
+5
View File
@@ -1479,6 +1479,11 @@ private:
long ext_log_pid_ = 0;
std::uintmax_t ext_log_offset_ = 0;
double ext_log_next_at_ = 0.0;
long ext_log_miss_pid_ = 0; // pid whose banner we failed to find
std::uintmax_t ext_log_miss_size_ = 0; // file size at that miss
double ext_log_miss_since_ = 0.0; // when this pid first missed (fresh-node grace)
double ext_log_retry_at_ = 0.0; // next allowed re-scan (ImGui::GetTime)
double ext_log_backoff_ = 0.0; // current backoff seconds (0 until grace elapses)
void abortRpcBusyCanary();
void feedDaemonBusy(const std::string& chunk);
void resetDaemonBusy();