v1.2.0: Immediate processing after eDNC download

- Reduced initial delay from stability check to 50ms
- Aggressive retry starting at 100ms (was 500ms)
- 15 retry attempts for longer lock holds
- Processes immediately when file becomes available

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
cproudlock
2025-12-12 08:36:19 -05:00
parent dbcff19b27
commit f594ba431b
2 changed files with 12 additions and 36 deletions

View File

@@ -36,14 +36,14 @@
.NOTES
Author: GE Aerospace - Rutland
Version: 1.1.0
Version: 1.2.0
Date: 2025-12-12
v1.1.0 - Improved file locking handling:
- Wait for file to stabilize (size stops changing)
- Exponential backoff retry (500ms -> 16s)
- Up to 10 retry attempts
v1.2.0 - Immediate processing:
- Process file immediately when eDNC releases it (50ms initial delay)
- Aggressive retry: 100ms -> 200ms -> 400ms -> 800ms (15 attempts)
- Debouncing to prevent duplicate processing
- Exclusive file lock for atomic read/write
Common problematic characters:
- 0xFF (255) - Padding/fill character
@@ -68,7 +68,7 @@ param(
)
# Script info
$ScriptVersion = "1.1.0"
$ScriptVersion = "1.2.0"
$ScriptName = "eDNC Special Character Fix"
# Display banner
@@ -132,38 +132,13 @@ $action = {
Write-Host "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') | $changeType | $fileName" -ForegroundColor White
# STEP 1: Wait for file to stabilize (size stops changing)
$stableChecks = 0
$lastSize = -1
$maxStableWait = 30 # Max 30 seconds waiting for file to stabilize
# Brief initial delay to let eDNC finish (50ms)
Start-Sleep -Milliseconds 50
while ($stableChecks -lt $maxStableWait) {
Start-Sleep -Milliseconds 500
try {
if (-not (Test-Path $path)) {
Write-Host " [SKIP] File no longer exists" -ForegroundColor Yellow
return
}
$currentSize = (Get-Item $path).Length
if ($currentSize -eq $lastSize -and $currentSize -gt 0) {
# File size hasn't changed - likely done writing
break
}
$lastSize = $currentSize
$stableChecks++
if ($stableChecks % 4 -eq 0) {
Write-Host " [WAIT] File still being written... ($([math]::Round($stableChecks/2))s)" -ForegroundColor DarkGray
}
}
catch {
$stableChecks++
}
}
# STEP 2: Try to acquire exclusive access with exponential backoff
$maxRetries = 10
# Try to acquire exclusive access - process immediately when available
$maxRetries = 15
$retryCount = 0
$baseDelay = 500 # Start with 500ms
$baseDelay = 100 # Start with 100ms, doubles each retry (100, 200, 400, 800...)
while ($retryCount -lt $maxRetries) {
$fileStream = $null