Skip to content

Commit 630434c

Browse files
committed
fixup! Break ties of PreferDistinct submissions with equal counts
Move check to top
1 parent d644aa5 commit 630434c

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

‎opsqueue/src/consumer/strategy.rs‎

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ impl Strategy {
120120
PreferDistinct { .. } => {
121121
let mut meta_keys_iter = self.meta_keys();
122122
let meta_keys: Vec<&str> = meta_keys_iter.by_ref().collect();
123+
if meta_keys.is_empty() {
124+
panic!("`PreferDistinct` always yields at least one meta key.")
125+
}
123126
let underlying = meta_keys_iter.take();
124127

125128
// Unique submission IDs from the underlying strategy. Note how
@@ -166,15 +169,9 @@ impl Strategy {
166169
qb.push(format!("counts_{i}.count ASC NULLS FIRST"));
167170
}
168171

169-
if meta_keys.is_empty() {
170-
panic!("`PreferDistinct` always yields at least one meta key.")
171-
} else {
172-
// Ensure that submissions with equal metadata counts use the
173-
// ordering of the underlying strategy as a tie-breaker.
174-
qb.push(", inner.underlying_row ASC");
175-
}
176-
177-
qb
172+
// Ensure that submissions with equal metadata counts use the
173+
// ordering of the underlying strategy as a tie-breaker.
174+
qb.push(", inner.underlying_row ASC")
178175
}
179176
}
180177
}

0 commit comments

Comments
 (0)