Skip to content

Commit b69b94d

Browse files
committed
[BUG] Do not leak tokio tasks in the log service.
The background tasks of wal3 were leaked because the log service was not calling shutdown when dropping a log. This PR corrects that.
1 parent ad7dd6b commit b69b94d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

rust/wal3/src/writer.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,15 @@ impl std::fmt::Debug for LogWriter {
377377
}
378378
}
379379

380+
impl Drop for LogWriter {
381+
fn drop(&mut self) {
382+
let mut inner = self.inner.lock().unwrap();
383+
if let Some(writer) = inner.writer.as_mut() {
384+
writer.shutdown();
385+
}
386+
}
387+
}
388+
380389
/////////////////////////////////////////// OnceLogWriter //////////////////////////////////////////
381390

382391
/// OnceLogWriter writes to a log once until contention is discovered. It must then be thrown away

0 commit comments

Comments
 (0)