Skip to content

Commit 46e01a7

Browse files
committed
store: Measure queue_push_blocked in stage 'process'
The queue_push_blocked section was being started on the Queue's stopwatch (stage 'writer'), but it should really be measured as part of the 'process' stage.
1 parent f2fd163 commit 46e01a7

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

store/postgres/src/writable.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use std::ops::{Deref, Range};
33
use std::sync::atomic::{AtomicBool, Ordering};
44
use std::sync::Mutex;
55

6-
use graph::components::metrics::stopwatch::Section;
76
use graph::parking_lot::RwLock;
87
use std::time::Instant;
98
use std::{collections::BTreeMap, sync::Arc};
@@ -866,13 +865,6 @@ impl Request {
866865
Request::RevertTo { .. } | Request::Stop => false,
867866
}
868867
}
869-
870-
fn stopwatch_section(&self, name: &str) -> Option<Section> {
871-
match self {
872-
Request::Write { stopwatch, .. } => Some(stopwatch.start_section(name)),
873-
Request::RevertTo { .. } | Request::Stop => None,
874-
}
875-
}
876868
}
877869

878870
/// A queue that asynchronously writes requests queued with `push` to the
@@ -1140,7 +1132,11 @@ impl Queue {
11401132
/// to fill up before writing them to maximize the chances that we build
11411133
/// a 'full' write batch, i.e., one that is either big enough or old
11421134
/// enough
1143-
async fn push_write(&self, batch: Batch) -> Result<(), StoreError> {
1135+
async fn push_write(
1136+
&self,
1137+
batch: Batch,
1138+
stopwatch: &StopwatchMetrics,
1139+
) -> Result<(), StoreError> {
11441140
let batch = if ENV_VARS.store.write_batch_size == 0
11451141
|| ENV_VARS.store.write_batch_duration.is_zero()
11461142
|| !self.batch_writes()
@@ -1213,7 +1209,7 @@ impl Queue {
12131209
self.stopwatch.cheap_clone(),
12141210
batch,
12151211
);
1216-
let _section = req.stopwatch_section("queue_push_blocked");
1212+
let _section = stopwatch.start_section("queue_push_blocked");
12171213
self.push(req).await?;
12181214
}
12191215
Ok(())
@@ -1498,7 +1494,7 @@ impl Writer {
14981494
Writer::Sync(store) => store.transact_block_operations(&batch, stopwatch).await,
14991495
Writer::Async { queue, .. } => {
15001496
self.check_queue_running()?;
1501-
queue.push_write(batch).await
1497+
queue.push_write(batch, stopwatch).await
15021498
}
15031499
}
15041500
}

0 commit comments

Comments
 (0)