Reduce health check interval in InstanceManager to improve responsiveness; adjust font size and line height in ConsoleLogsDisplay for better readability.

This commit is contained in:
Miguel 2025-08-26 16:54:58 +02:00
parent c5cd0494ad
commit c251c76072
3 changed files with 5 additions and 89 deletions

View File

@ -1,27 +1,7 @@
# PowerShell Build Script for S7 Streamer & Logger
# Compatible with PowerShell Core and Windows PowerShell
# Function to safely handle Python process management
function Show-PythonProcessDetails {
param($processes)
Write-Host "`nDetailed Python process information:" -ForegroundColor Cyan
for ($i = 0; $i -lt $processes.Count; $i++) {
$proc = $processes[$i]
$commandLine = ""
try {
$commandLine = (Get-WmiObject Win32_Process -Filter "ProcessId = $($proc.Id)").CommandLine
} catch {
$commandLine = "Unable to retrieve command line"
}
Write-Host "[$($i+1)] PID: $($proc.Id) - $($proc.ProcessName)" -ForegroundColor White
Write-Host " Window: $($proc.MainWindowTitle)" -ForegroundColor Gray
Write-Host " Command: $commandLine" -ForegroundColor Gray
Write-Host " Start Time: $($proc.StartTime)" -ForegroundColor Gray
Write-Host ""
}
}
Write-Host "Starting build process..." -ForegroundColor Green
@ -65,71 +45,7 @@ try {
Write-Host "Waiting for file handles to be released..." -ForegroundColor Yellow
Start-Sleep -Seconds 3
# Check for Python processes that might hold file handles
$pythonProcesses = Get-Process -Name "python*" -ErrorAction SilentlyContinue | Where-Object { $_.ProcessName -match "python" }
if ($pythonProcesses.Count -gt 0) {
Write-Host "`nFound $($pythonProcesses.Count) Python process(es):" -ForegroundColor Yellow
$pythonProcesses | ForEach-Object {
Write-Host " PID: $($_.Id) - $($_.ProcessName) - $($_.MainWindowTitle)" -ForegroundColor Gray
}
Write-Host "`nSome Python processes might be holding file handles that could interfere with compression." -ForegroundColor Yellow
Write-Host "Options:" -ForegroundColor Cyan
Write-Host " [y] Terminate ALL Python processes" -ForegroundColor White
Write-Host " [d] Show DETAILED information and select specific processes" -ForegroundColor White
Write-Host " [n] Keep all processes running (default)" -ForegroundColor White
$response = Read-Host "Choose an option (y/d/N)"
if ($response -eq 'y' -or $response -eq 'Y') {
Write-Host "Terminating ALL Python processes..." -ForegroundColor Yellow
try {
$pythonProcesses | Stop-Process -Force -ErrorAction SilentlyContinue
Write-Host "All Python processes terminated." -ForegroundColor Green
} catch {
Write-Host "Warning: Some processes could not be terminated: $($_.Exception.Message)" -ForegroundColor Yellow
}
Start-Sleep -Seconds 2
} elseif ($response -eq 'd' -or $response -eq 'D') {
Show-PythonProcessDetails -processes $pythonProcesses
Write-Host "Enter the numbers of processes to terminate (e.g., '1,3,5' or 'all' or 'none'):" -ForegroundColor Cyan
$selection = Read-Host "Selection"
if ($selection -eq 'all') {
Write-Host "Terminating ALL Python processes..." -ForegroundColor Yellow
$pythonProcesses | Stop-Process -Force -ErrorAction SilentlyContinue
} elseif ($selection -ne 'none' -and $selection -ne '') {
$indices = $selection.Split(',') | ForEach-Object { $_.Trim() }
Write-Host "Terminating selected processes..." -ForegroundColor Yellow
foreach ($index in $indices) {
try {
$processIndex = [int]$index - 1
if ($processIndex -ge 0 -and $processIndex -lt $pythonProcesses.Count) {
$proc = $pythonProcesses[$processIndex]
Stop-Process -Id $proc.Id -Force -ErrorAction SilentlyContinue
Write-Host " Terminated PID $($proc.Id)" -ForegroundColor Green
} else {
Write-Host " Invalid index: $index" -ForegroundColor Red
}
} catch {
Write-Host " Could not terminate process $index`: $($_.Exception.Message)" -ForegroundColor Red
}
}
} else {
Write-Host "No processes will be terminated." -ForegroundColor Yellow
}
Start-Sleep -Seconds 2
} else {
Write-Host "Keeping all Python processes running. If compression fails, you may need to close them manually." -ForegroundColor Yellow
}
} else {
Write-Host "No Python processes found that could interfere with build." -ForegroundColor Green
}
} catch {
Write-Host "PyInstaller build failed: $($_.Exception.Message)" -ForegroundColor Red

View File

@ -1659,9 +1659,9 @@ function ConsoleLogsDisplay({ logs, loading, onRefresh }) {
p={4}
height="600px"
overflowY="scroll"
fontFamily="mono"
fontSize="sm"
lineHeight="1.4"
fontFamily="mono"
fontSize="xs"
lineHeight="1.3"
color={logColor}
sx={{
'&::-webkit-scrollbar': {

View File

@ -31,7 +31,7 @@ class InstanceManager:
lock_file: str = "plc_streamer.lock",
health_endpoint: str = "/api/health",
check_timeout: float = 3.0,
check_interval: float = 5.0,
check_interval: float = 1.0,
):
"""
Initialize the instance manager