refactor: move daemon registry into host-runtime store
This commit is contained in:
@@ -496,6 +496,16 @@ async fn garbage_collect_attachment_files(
|
||||
.map_err(|error| format!("Attachment GC task failed: {error}"))?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn webview_log(level: u8, message: String) {
|
||||
match level {
|
||||
0 => log::debug!("[webview] {}", message),
|
||||
1 => log::info!("[webview] {}", message),
|
||||
2 => log::warn!("[webview] {}", message),
|
||||
_ => log::error!("[webview] {}", message),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
tauri::Builder::default()
|
||||
@@ -533,7 +543,8 @@ pub fn run() {
|
||||
copy_attachment_file,
|
||||
read_file_base64,
|
||||
delete_attachment_file,
|
||||
garbage_collect_attachment_files
|
||||
garbage_collect_attachment_files,
|
||||
webview_log
|
||||
])
|
||||
.setup(|app| {
|
||||
let setup_start = std::time::Instant::now();
|
||||
@@ -558,9 +569,6 @@ pub fn run() {
|
||||
.target(tauri_plugin_log::Target::new(
|
||||
tauri_plugin_log::TargetKind::Stdout,
|
||||
))
|
||||
.target(tauri_plugin_log::Target::new(
|
||||
tauri_plugin_log::TargetKind::Webview,
|
||||
))
|
||||
.build(),
|
||||
)?;
|
||||
|
||||
|
||||
@@ -604,6 +604,14 @@ fn start_managed_daemon_internal(app: &AppHandle) -> Result<ManagedDaemonStatus,
|
||||
log::info!("[daemon] start command succeeded ({}ms), waiting for daemon to be ready", t0.elapsed().as_millis());
|
||||
for attempt in 0..150 {
|
||||
let daemon_status = managed_daemon_status_internal(app)?;
|
||||
log::info!(
|
||||
"[daemon] poll attempt {}: status={:?} server_id={:?} listen={:?} pid={:?}",
|
||||
attempt + 1,
|
||||
daemon_status.status,
|
||||
daemon_status.server_id,
|
||||
daemon_status.listen,
|
||||
daemon_status.pid
|
||||
);
|
||||
if daemon_status.status == "running" && !daemon_status.server_id.trim().is_empty() {
|
||||
log::info!(
|
||||
"[daemon] ready after {} attempts, {}ms (pid={:?})",
|
||||
|
||||
Reference in New Issue
Block a user