File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
src/Docfx.Common/FileAbstractLayer Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -59,17 +59,18 @@ public override Stream Create(RelativePath file)
5959 catch ( IOException e ) when ( ( e . HResult & 0x0000FFFF ) == 32 ) // ERROR_SHARING_VIOLATION: 0x80070020
6060 {
6161 // If retry failed 3 times. throw exception
62- if ( ++ retryCount > 3 )
62+ if ( retryCount > 3 )
6363 throw ;
6464
65- var sleepDelay = 500 * retryCount ;
66-
6765 var message = FileLockCheck . GetLockingProcessNames ( path ) ;
6866 if ( string . IsNullOrEmpty ( message ) )
6967 message = "File is locked by other process" ;
7068
69+ var sleepDelay = 500 * retryCount ; // Retry immediately on first exception.
7170 Logger . LogWarning ( $ "{ message } . Retry after { sleepDelay } [ms]", file : path , code : WarningCodes . Build . LockedFile ) ;
72- Thread . Sleep ( 500 * retryCount ) ;
71+ Thread . Sleep ( sleepDelay ) ;
72+
73+ ++ retryCount ;
7374 goto Retry ;
7475 }
7576 }
You can’t perform that action at this time.
0 commit comments