From ee213696aa611e2d1b8101e3922658070cc01f5f Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 20 Jul 2021 12:28:04 -0600 Subject: [PATCH] Replace DeterministicExecutor::reset with forbid_parking There's really no point calling reset if we plan on parking afterwards. Co-Authored-By: Max Brunsfeld --- gpui/src/executor.rs | 15 +++------------ server/src/tests.rs | 2 -- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/gpui/src/executor.rs b/gpui/src/executor.rs index 91978e0e706e68955f9476bd78cde9c4d49e5be6..bc23b63fcc4816e4f2a8bef1a0de7e37033918db 100644 --- a/gpui/src/executor.rs +++ b/gpui/src/executor.rs @@ -328,23 +328,14 @@ impl Foreground { } } - pub fn reset(&self) { - match self { - Self::Platform { .. } => panic!("can't call this method on a platform executor"), - Self::Test(_) => panic!("can't call this method on a test executor"), - Self::Deterministic(executor) => { - let state = &mut *executor.state.lock(); - state.rng = StdRng::seed_from_u64(state.seed); - } - } - } - pub fn forbid_parking(&self) { match self { Self::Platform { .. } => panic!("can't call this method on a platform executor"), Self::Test(_) => panic!("can't call this method on a test executor"), Self::Deterministic(executor) => { - executor.state.lock().forbid_parking = true; + let mut state = executor.state.lock(); + state.forbid_parking = true; + state.rng = StdRng::seed_from_u64(state.seed); } } } diff --git a/server/src/tests.rs b/server/src/tests.rs index 9c05e09fc5fb145d031bab8b265b3578324d2641..8767155ca0b220f9139c41896fd036f525c26ae9 100644 --- a/server/src/tests.rs +++ b/server/src/tests.rs @@ -523,8 +523,6 @@ impl TestServer { .await .unwrap(); - // Reset the executor because running SQL queries has a non-deterministic impact on it. - cx.foreground().reset(); client }