Skip to content

Commit 3824c85

Browse files
jyn514Joshua Nelson
authored and
Joshua Nelson
committed
Cleanup the queue builder a bit
1 parent e7f15e9 commit 3824c85

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/docbuilder/queue.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ impl DocBuilder {
7272
.get(0))
7373
}
7474

75-
/// Builds the top package from the queue. Returns whether the queue was empty.
75+
/// Builds the top package from the queue. Returns whether there was a package in the queue.
76+
///
77+
/// Note that this will return `Ok(true)` even if the package failed to build.
7678
pub(crate) fn build_next_queue_package(
7779
&mut self,
7880
builder: &mut RustwideBuilder,
@@ -84,10 +86,10 @@ impl DocBuilder {
8486

8587
let query = conn.query(
8688
"SELECT id, name, version
87-
FROM queue
88-
WHERE attempt < 5
89-
ORDER BY priority ASC, attempt ASC, id ASC
90-
LIMIT 1",
89+
FROM queue
90+
WHERE attempt < 5
91+
ORDER BY priority ASC, attempt ASC, id ASC
92+
LIMIT 1",
9193
&[],
9294
)?;
9395

@@ -105,7 +107,6 @@ impl DocBuilder {
105107
let conn = self.db.get()?;
106108

107109
let _ = conn.execute("DELETE FROM queue WHERE id = $1", &[&id]);
108-
crate::web::metrics::TOTAL_BUILDS.inc();
109110
}
110111
Err(e) => {
111112
let conn = self.db.get()?;
@@ -118,7 +119,6 @@ impl DocBuilder {
118119
let attempt: i32 = rows.get(0).get(0);
119120
if attempt >= 5 {
120121
crate::web::metrics::FAILED_BUILDS.inc();
121-
crate::web::metrics::TOTAL_BUILDS.inc();
122122
}
123123
error!(
124124
"Failed to build package {}-{} from queue: {}\nBacktrace: {}",
@@ -130,6 +130,7 @@ impl DocBuilder {
130130
}
131131
}
132132

133+
crate::web::metrics::TOTAL_BUILDS.inc();
133134
Ok(true)
134135
}
135136
}

0 commit comments

Comments
 (0)