aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_db/src/change.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_db/src/change.rs')
-rw-r--r--crates/ide_db/src/change.rs15
1 files changed, 1 insertions, 14 deletions
diff --git a/crates/ide_db/src/change.rs b/crates/ide_db/src/change.rs
index 8b4fd7ab8..7f98111c4 100644
--- a/crates/ide_db/src/change.rs
+++ b/crates/ide_db/src/change.rs
@@ -1,7 +1,7 @@
1//! Defines a unit of change that can applied to a state of IDE to get the next 1//! Defines a unit of change that can applied to a state of IDE to get the next
2//! state. Changes are transactional. 2//! state. Changes are transactional.
3 3
4use std::{fmt, sync::Arc, time}; 4use std::{fmt, sync::Arc};
5 5
6use base_db::{ 6use base_db::{
7 salsa::{Database, Durability, SweepStrategy}, 7 salsa::{Database, Durability, SweepStrategy},
@@ -81,8 +81,6 @@ impl fmt::Debug for RootChange {
81 } 81 }
82} 82}
83 83
84const GC_COOLDOWN: time::Duration = time::Duration::from_millis(100);
85
86impl RootDatabase { 84impl RootDatabase {
87 pub fn request_cancellation(&mut self) { 85 pub fn request_cancellation(&mut self) {
88 let _p = profile::span("RootDatabase::request_cancellation"); 86 let _p = profile::span("RootDatabase::request_cancellation");
@@ -126,23 +124,12 @@ impl RootDatabase {
126 } 124 }
127 } 125 }
128 126
129 pub fn maybe_collect_garbage(&mut self) {
130 if cfg!(feature = "wasm") {
131 return;
132 }
133
134 if self.last_gc_check.elapsed() > GC_COOLDOWN {
135 self.last_gc_check = crate::wasm_shims::Instant::now();
136 }
137 }
138
139 pub fn collect_garbage(&mut self) { 127 pub fn collect_garbage(&mut self) {
140 if cfg!(feature = "wasm") { 128 if cfg!(feature = "wasm") {
141 return; 129 return;
142 } 130 }
143 131
144 let _p = profile::span("RootDatabase::collect_garbage"); 132 let _p = profile::span("RootDatabase::collect_garbage");
145 self.last_gc = crate::wasm_shims::Instant::now();
146 133
147 let sweep = SweepStrategy::default().discard_values().sweep_all_revisions(); 134 let sweep = SweepStrategy::default().discard_values().sweep_all_revisions();
148 135