record-daemon: stop reading every timeline at startup
The store parsed all 309 timeline files on boot and held them in memory. Each file carries the raw API responses, so 527 MB of JSON became about 2 GB of serde values and nine seconds of startup. Nothing reads the store back: the app loads the same files from disk itself. The daemon now only writes timelines.
This commit is contained in:
1 parent
365e4ad732
commit
4efc2f3968
1 file changed
+3
-7
@@ -105,7 +105,6 @@ impl Daemon {
|
||||
Ok::<_, String>(())
|
||||
})
|
||||
.await;
|
||||
|
||||
match result {
|
||||
Ok(Ok(())) => {}
|
||||
Ok(Err(e)) => {
|
||||
@@ -120,10 +119,9 @@ impl Daemon {
|
||||
}
|
||||
}
|
||||
|
||||
// Load existing recordings from disk
|
||||
self.timeline_store.read().load_from_disk()?;
|
||||
|
||||
// Initialize IPC server
|
||||
// Existing timelines are not read into memory. They stay on disk as JSON, the app
|
||||
// reads them from there, and nothing here serves them back over IPC. Preloading the
|
||||
// store used to cost about two gigabytes of parsed JSON and nine seconds of startup.
|
||||
let ipc_config = IpcServerConfig {
|
||||
socket_path: self
|
||||
.settings
|
||||
@@ -134,7 +132,6 @@ impl Daemon {
|
||||
.unwrap_or_else(ipc::default_socket_path),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let handlers = IpcHandlers::new(
|
||||
self.settings.clone(),
|
||||
self.recording_engine.clone(),
|
||||
@@ -146,7 +143,6 @@ impl Daemon {
|
||||
let mut ipc_server = IpcServer::new(ipc_config, handlers);
|
||||
ipc_server.start().await?;
|
||||
self.ipc_server = Some(ipc_server);
|
||||
|
||||
info!("Daemon initialized successfully");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user