Skip to content

Commit da8bcbd

Browse files
committed
Increment deque (retry) counter on job dequeue
1 parent 356ad6c commit da8bcbd

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

database/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,7 @@ pub struct BenchmarkJob {
11121112
benchmark_set: BenchmarkSet,
11131113
created_at: DateTime<Utc>,
11141114
status: BenchmarkJobStatus,
1115-
retry: u32,
1115+
deque_counter: u32,
11161116
}
11171117

11181118
impl BenchmarkJob {
@@ -1147,6 +1147,11 @@ impl BenchmarkJob {
11471147
| BenchmarkJobStatus::Completed { collector_name, .. } => Some(collector_name),
11481148
}
11491149
}
1150+
1151+
/// How many times was the job already dequed?
1152+
pub fn deque_count(&self) -> u32 {
1153+
self.deque_counter
1154+
}
11501155
}
11511156

11521157
/// Describes the final state of a job

database/src/pool/postgres.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1840,6 +1840,7 @@ where
18401840
) -> anyhow::Result<Option<(BenchmarkJob, ArtifactId)>> {
18411841
// We take the oldest job from the job_queue matching the benchmark_set,
18421842
// target and status of 'queued'
1843+
// If a job was dequeued, we increment its retry (dequeue) count
18431844
let row_opt = self
18441845
.conn()
18451846
.query_opt(
@@ -1863,7 +1864,8 @@ where
18631864
SET
18641865
collector_name = $4,
18651866
started_at = NOW(),
1866-
status = $5
1867+
status = $5,
1868+
retry = retry + 1
18671869
FROM
18681870
picked
18691871
WHERE

0 commit comments

Comments
 (0)