diff --git a/README.md b/README.md index f4664df..043b590 100644 --- a/README.md +++ b/README.md @@ -129,6 +129,7 @@ The script uses exponential backoff (500ms → 1s → 2s → 4s → up to 16s) f | Version | Date | Changes | |---------|------|---------| +| 1.2.0 | 2025-12-12 | Immediate processing: 50ms delay, aggressive retry (100ms+), 15 attempts | | 1.1.0 | 2025-12-12 | Improved file locking: stability check, exponential backoff, debouncing | | 1.0.0 | 2025-12-12 | Initial release | diff --git a/eDNC-SpecialCharFix.ps1 b/eDNC-SpecialCharFix.ps1 index d8a6fd7..8425be7 100644 --- a/eDNC-SpecialCharFix.ps1 +++ b/eDNC-SpecialCharFix.ps1 @@ -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