record-daemon: obs-context refactoring, gpu detection code
record-daemon / Build, check and test (push) Failing after 48s

This commit is contained in:
2026-03-21 18:54:01 +01:00
parent 5d4fecc108
commit 8e885ffc64
5 changed files with 262 additions and 141 deletions
+7 -17
View File
@@ -221,15 +221,11 @@ impl Daemon {
/// Handle a game event.
async fn handle_game_event(&self, event: GameEvent) -> Result<()> {
use std::io::Write;
info!("[EVENT_HANDLER] Game event received: {:?}", event);
std::io::stderr().flush().ok();
// Process state transitions
if let Some(transition) = self.state_machine.process_event(&event) {
info!("[EVENT_HANDLER] State transition: {:?}", transition);
std::io::stderr().flush().ok();
self.state_machine.transition(transition.clone());
@@ -240,22 +236,19 @@ impl Daemon {
"[EVENT_HANDLER] GameStarted transition - game_id: {}, champion: {:?}",
game_id, champion
);
std::io::stderr().flush().ok();
// If already recording, stop the current recording first
if self.state_machine.is_recording() {
info!(
"[EVENT_HANDLER] Stopping previous recording before starting new one"
);
std::io::stderr().flush().ok();
if let Err(e) = self.stop_recording().await {
warn!("[EVENT_HANDLER] Failed to stop previous recording: {}", e);
std::io::stderr().flush().ok();
}
}
info!("[EVENT_HANDLER] Calling start_recording...");
std::io::stderr().flush().ok();
// Wrap the start_recording call to catch any panics
let start_result =
@@ -269,7 +262,7 @@ impl Daemon {
"[EVENT_HANDLER] PANIC before start_recording: {:?}",
panic_info
);
std::io::stderr().flush().ok();
eprintln!(
"[EVENT_HANDLER] PANIC before start_recording: {:?}",
panic_info
@@ -278,20 +271,18 @@ impl Daemon {
if let Err(e) = self.start_recording(game_id, champion.as_deref()).await {
error!("[EVENT_HANDLER] Failed to start recording: {}", e);
std::io::stderr().flush().ok();
// Don't propagate error - keep daemon running
} else {
info!("[EVENT_HANDLER] start_recording completed successfully");
std::io::stderr().flush().ok();
}
}
StateTransition::GameEnded => {
info!("[EVENT_HANDLER] GameEnded transition");
std::io::stderr().flush().ok();
if let Err(e) = self.stop_recording().await {
error!("[EVENT_HANDLER] Failed to stop recording: {}", e);
std::io::stderr().flush().ok();
// Don't propagate error - keep daemon running
}
}
@@ -311,7 +302,7 @@ impl Daemon {
}
info!("[EVENT_HANDLER] Event handling complete");
std::io::stderr().flush().ok();
Ok(())
}
@@ -500,11 +491,10 @@ async fn main() -> Result<()> {
// Create and run daemon
let mut daemon = Daemon::new(settings);
// Handle shutdown signals
let shutdown_tx = daemon.shutdown_tx.clone();
#[cfg(unix)]
{
// Handle shutdown signals
let shutdown_tx = daemon.shutdown_tx.clone();
use futures::StreamExt;
use signal_hook::consts::signal::*;
use signal_hook_tokio::Signals;