Skip to content

Commit 598b498

Browse files
authored
console: pause should prevent expiring stopped tasks (console-rs#110)
Closes console-rs#107
1 parent 1ad57af commit 598b498

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

console/src/tasks.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,11 @@ impl State {
242242
}
243243

244244
pub(crate) fn retain_active(&mut self) {
245+
// Don't clean up stopped tasks while the console is paused.
246+
if self.is_paused() {
247+
return;
248+
}
249+
245250
self.tasks.retain(|_, task| {
246251
let mut task = task.borrow_mut();
247252
if task.completed_for == 0 {
@@ -455,7 +460,6 @@ impl Default for SortBy {
455460

456461
impl SortBy {
457462
pub fn sort(&self, now: SystemTime, tasks: &mut Vec<Weak<RefCell<Task>>>) {
458-
// tasks.retain(|t| t.upgrade().is_some());
459463
match self {
460464
Self::Tid => tasks.sort_unstable_by_key(|task| task.upgrade().map(|t| t.borrow().id)),
461465
Self::Name => {

0 commit comments

Comments
 (0)