Skip to content

Commit 5b36f27

Browse files
committed
fix: mark SQL test planning finished on panic and drop an unused cache dependency
1 parent 65bcdbc commit 5b36f27

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

‎Cargo.lock‎

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎crates/sqlbuild-cache/Cargo.toml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ rust-version.workspace = true
1010
[dependencies]
1111
blake3.workspace = true
1212
rayon.workspace = true
13-
rustc-hash.workspace = true
1413
serde_json.workspace = true
1514
sha2.workspace = true
1615
sqlbuild-core.workspace = true

‎crates/sqlbuild-python/src/bindings/_helpers/planner_entries/test_planning.rs‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ struct PlanningThreads {
3838
running: AtomicUsize,
3939
}
4040

41+
/// Marks one planning thread finished when dropped, including when the thread panics.
42+
struct RunningPlanning(Py<PlanningThreads>);
43+
44+
impl Drop for RunningPlanning {
45+
fn drop(&mut self) {
46+
self.0.get().finished();
47+
}
48+
}
49+
4150
impl PlanningThreads {
4251
fn started(&self) {
4352
self.running.fetch_add(1, Ordering::AcqRel);
@@ -191,13 +200,13 @@ pub(crate) fn start_planning(
191200
let spawned = std::thread::Builder::new()
192201
.name(TEST_PLANNING_THREAD.to_owned())
193202
.spawn(move || {
203+
let _running = RunningPlanning(threads);
194204
let planned: Planned = Python::attach(|py| {
195205
let planned: Planned = plan(py, &request);
196206
drop(request);
197207
planned
198208
});
199209
let _receiver_gone = sender.send(planned);
200-
threads.get().finished();
201210
});
202211
if let Err(error) = spawned {
203212
planning_threads(py)?.get().finished();

0 commit comments

Comments
 (0)