Skip to content

Commit 40966a2

Browse files
committed
fix: address QA round 2
Update the header doc and a test comment to say the success cooldown counts from when the index finished (about 1/4 duty cycle), matching the round-1 anchor change. Signed-off-by: Shane McCarron <[email protected]>
1 parent a83e75b commit 40966a2

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

‎src/watcher/watcher.h‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,9 @@ int cbm_watcher_index_backoff_ms(int interval_ms, int consecutive_failures);
198198
/* Return the delay (ms) before the next poll after a SUCCESSFUL re-index that
199199
* took `index_elapsed_ms`: max(interval_ms, INDEX_COOLDOWN_FACTOR (3) x
200200
* index_elapsed_ms), with the cooldown term capped at INDEX_COOLDOWN_CEILING_MS
201-
* (30 min). Measured from the index start, so the watcher spends at most ~1/3
202-
* of wall time indexing a project; sub-second indexes keep `interval_ms`.
201+
* (30 min). The caller counts it from when the index finished, so the watcher
202+
* spends at most ~1/4 of wall time indexing a project; sub-second indexes keep
203+
* `interval_ms`.
203204
* Never below `interval_ms`; overflow-safe; negative inputs act as zero. */
204205
int cbm_watcher_success_delay_ms(int interval_ms, int64_t index_elapsed_ms);
205206

‎tests/test_watcher.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2273,7 +2273,7 @@ TEST(success_delay_fast_index_keeps_interval) {
22732273
TEST(success_delay_slow_index_scales_by_factor) {
22742274
ASSERT_EQ(cbm_watcher_success_delay_ms(5000, 1667), 5001);
22752275
ASSERT_EQ(cbm_watcher_success_delay_ms(5000, 10000), 30000);
2276-
/* 5-minute rebuild → next poll 15 min after its start, ~10 min idle. */
2276+
/* 5-minute rebuild → next poll 15 min after it finishes. */
22772277
ASSERT_EQ(cbm_watcher_success_delay_ms(60000, 300000), 900000);
22782278
PASS();
22792279
}

0 commit comments

Comments
 (0)