Enhance development workflow and deployment practices for Archipelago
- Updated the Development-Workflow documentation to clarify deployment strategy, emphasizing direct deployment to the live system for testing. - Added detailed instructions for the deployment command, including syncing code, building frontend and backend, and restarting services. - Improved SSH key management section to assist with authentication issues. - Expanded the testing workflow to include steps for checking logs and syncing changes back to the ISO build. - Updated the ISO build integration section to ensure system-level changes are captured for future builds. - Refactored various sections for clarity and completeness, including deployment paths and system configuration files.
This commit is contained in:
@@ -9,7 +9,7 @@ use std::net::SocketAddr;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use tokio::net::TcpListener;
|
||||
use tracing::{error, info};
|
||||
use tracing::{debug, error, info};
|
||||
|
||||
pub struct Server {
|
||||
_config: Config,
|
||||
@@ -34,8 +34,8 @@ impl Server {
|
||||
error!("Failed to scan Docker containers: {}", e);
|
||||
}
|
||||
|
||||
// Periodic scan every 5 seconds
|
||||
let mut interval = tokio::time::interval(Duration::from_secs(5));
|
||||
// Periodic scan every 10 seconds (only broadcasts if state changed)
|
||||
let mut interval = tokio::time::interval(Duration::from_secs(10));
|
||||
loop {
|
||||
interval.tick().await;
|
||||
if let Err(e) = scan_and_update_packages(&scanner, &state).await {
|
||||
@@ -114,10 +114,19 @@ async fn scan_and_update_packages(
|
||||
) -> Result<()> {
|
||||
let packages = scanner.scan_containers().await?;
|
||||
|
||||
// Only update if we have packages AND they're different from current state
|
||||
if !packages.is_empty() {
|
||||
let (mut data, _) = state.get_snapshot().await;
|
||||
data.package_data = packages;
|
||||
state.update_data(data).await;
|
||||
let (current_data, _) = state.get_snapshot().await;
|
||||
|
||||
// Check if packages actually changed to avoid unnecessary broadcasts
|
||||
let packages_changed = current_data.package_data != packages;
|
||||
|
||||
if packages_changed {
|
||||
let mut data = current_data;
|
||||
data.package_data = packages;
|
||||
state.update_data(data).await;
|
||||
debug!("📦 Container state changed, broadcasting update");
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user