internal: track missing .check_cancelled

This commit is contained in:
Aleksey Kladov 2021-03-29 21:08:07 +03:00
parent 2381a54c2f
commit 483a5bc9c8
3 changed files with 81 additions and 11 deletions

View file

@ -59,6 +59,8 @@ pub trait CheckCanceled {
Self: Sized + panic::RefUnwindSafe,
F: FnOnce(&Self) -> T + panic::UnwindSafe,
{
// Uncomment to debug missing cancellations.
// let _span = profile::heartbeat_span();
panic::catch_unwind(|| f(self)).map_err(|err| match err.downcast::<Canceled>() {
Ok(canceled) => *canceled,
Err(payload) => panic::resume_unwind(payload),
@ -68,6 +70,7 @@ pub trait CheckCanceled {
impl<T: salsa::Database> CheckCanceled for T {
fn check_canceled(&self) {
// profile::heartbeat();
if self.salsa_runtime().is_current_revision_canceled() {
Canceled::throw()
}