atagen

macltok

public
Star0
Watch0

Commit 3dab4a4e73f4

tarball

atagen <boss@atagen.co>2026-10-28 06:43 UTC

1 file changed+7-0
engine: log each shutdown step at debug

An old engine handing over to a reloaded one lingers a median 1.64s after Shutdown, and nothing says which step holds it up.
Modified file: src/engine/mod.rs+7 additions
@@ -1238,17 +1238,24 @@ impl Engine {
12381238 self.client.remove_event_handler(handler);
12391239 }
12401240 self.port.close();
1241+ tracing::debug!(step = "sync", "engine shutdown step");
12411242 self.sync.stop().await;
12421243 if self.mentions_service.is_none() {
1244+ tracing::debug!(step = "mentions", "engine shutdown step");
12431245 self.mentions.stop().await;
12441246 }
12451247 if self.search_service.is_none() {
1248+ tracing::debug!(step = "search", "engine shutdown step");
12461249 self.search.stop().await;
12471250 }
1251+ tracing::debug!(step = "tasks", "engine shutdown step");
12481252 self.tasks.shutdown().await;
12491253 self.rooms.clear();
1254+ tracing::debug!(step = "contexts", "engine shutdown step");
12501255 self.contexts.clear().await;
1256+ tracing::debug!(step = "media", "engine shutdown step");
12511257 self.media.clear().await;
1258+ tracing::debug!(step = "done", "engine shutdown step");
12521259 self.port
12531260 .connection_sender()
12541261 .send_replace(ConnectionState::Stopped);