Skip to content

Commit 224abad

Browse files
authored
fix(pool): Emit metric before and after (#4556)
1 parent 0b1dbb2 commit 224abad

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

relay-threading/src/multiplexing.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,17 @@ where
153153
let mut this = self.project();
154154

155155
loop {
156+
// We report before polling since we might have only blocking tasks meaning that the
157+
// measure after the `poll_tasks_until_pending` will return 0, since all futures will
158+
// be completed.
159+
this.metrics
160+
.active_tasks
161+
.store(this.tasks.len() as u64, Ordering::Relaxed);
162+
156163
this.tasks.as_mut().poll_tasks_until_pending(cx);
157164

158-
// We report how many tasks are being concurrently polled in this future.
165+
// We also want to report after polling since we might have finished polling some futures
166+
// and some not.
159167
this.metrics
160168
.active_tasks
161169
.store(this.tasks.len() as u64, Ordering::Relaxed);

0 commit comments

Comments
 (0)