Fix leaking test contexts

I was unable to run the collab tests locally because I would run out of
file descriptors.

From some digging it turned out that tokio allocates a new file
descriptor to do work on the CurrentThread using KQUEUE.

We create a new tokio Runtime with each database connection, and these
database connections were being retained by the Client, which is
retained by the Context.

Cleaning up our leaked contexts fixes the problem (though does make me
wonder if a different approach might be preferrable).
This commit is contained in:
Conrad Irwin 2024-01-22 22:57:32 -07:00
parent ba5b969e10
commit 0b1b758f02
2 changed files with 34 additions and 9 deletions

View file

@ -746,9 +746,9 @@ impl TestClient {
let window = cx.update(|cx| cx.active_window().unwrap().downcast::<Workspace>().unwrap());
let view = window.root_view(cx).unwrap();
let cx = Box::new(VisualTestContext::from_window(*window.deref(), cx));
let cx = VisualTestContext::from_window(*window.deref(), cx).as_mut();
// it might be nice to try and cleanup these at the end of each test.
(view, Box::leak(cx))
(view, cx)
}
}