Refactor data loading and query projections

This commit is contained in:
b17301
2026-05-18 21:01:46 +09:00
parent 49a7a45070
commit 2ab74bac88
11 changed files with 6218 additions and 968 deletions
+12 -2
View File
@@ -35,7 +35,17 @@ if ss -ltn "( sport = :${PORT} )" | tail -n +2 | grep -q .; then
exit 1
fi
export INTRANET_AUTO_RELOAD="${INTRANET_AUTO_RELOAD:-0}"
export INTRANET_AUTO_RELOAD="${INTRANET_AUTO_RELOAD:-1}"
export INTRANET_PORT="$PORT"
echo "서버를 시작합니다: http://127.0.0.1:${PORT} (auto_reload=${INTRANET_AUTO_RELOAD})"
echo "예기치 않게 종료되면 2초 후 자동 재시작합니다."
exec ./.venv/bin/python main.py
while true; do
./.venv/bin/python main.py
exit_code=$?
if [ "$exit_code" -eq 0 ]; then
exit 0
fi
echo "서버가 종료되었습니다 (exit=${exit_code}). 2초 후 다시 시작합니다."
sleep 2
done
+28 -2
View File
@@ -14,7 +14,7 @@ $knownPorts = @{
function Get-WslListeningPorts {
$raw = wsl.exe bash -lc "ss -ltnH 2>/dev/null"
if (-not $raw) {
throw "WSL listening TCP 포트를 확인하지 못했습니다."
return @()
}
$portMap = @{}
@@ -110,8 +110,27 @@ $listenAddresses = $listenAddresses | Where-Object { -not [string]::IsNullOrWhit
Write-Host "Setting Windows portproxy for all active WSL TCP ports..." -ForegroundColor Cyan
Write-Host "WSL IP: $WslIp"
$portEntries = @(Get-WslListeningPorts)
$knownPortEntries = @()
foreach ($knownPort in ($knownPorts.Keys | Sort-Object)) {
$existingEntry = @($portEntries | Where-Object { [int]$_.Port -eq [int]$knownPort } | Select-Object -First 1)
if ($existingEntry -and $existingEntry.Count -gt 0) {
continue
}
$hosts = New-Object System.Collections.Generic.List[string]
$hosts.Add("not-listening-yet")
$knownPortEntries += [ordered]@{
Port = [int]$knownPort
Hosts = $hosts
ExternallyReachable = $true
Assumed = $true
}
}
$portEntries = @($portEntries + $knownPortEntries | Sort-Object Port)
if (-not $portEntries -or $portEntries.Count -eq 0) {
throw "외부에서 접근 가능한 WSL TCP 포트를 찾지 못했습니다."
throw "등록할 WSL TCP 포트를 찾지 못했습니다."
}
Write-Host "Detected ports: $((@($portEntries | ForEach-Object { $_.Port })) -join ', ')"
@@ -130,9 +149,16 @@ foreach ($entry in $reachableEntries) {
$appInfo = $knownPorts[$port]
$displayName = if ($appInfo) { [string]$appInfo.Name } else { "wsl-port-$port" }
$ruleName = if ($appInfo) { [string]$appInfo.RuleName } else { "WSL-PORT-$port" }
$assumed = $false
if ($entry.Contains("Assumed")) {
$assumed = [bool]$entry.Assumed
}
Write-Host ""
Write-Host "$displayName : $port ($($entry.Hosts -join ', '))" -ForegroundColor Cyan
if ($assumed) {
Write-Host " Known service port is not listening yet; portproxy will still be refreshed to the current WSL IP." -ForegroundColor Yellow
}
foreach ($address in $listenAddresses) {
netsh interface portproxy delete v4tov4 listenport=$port listenaddress=$address | Out-Null