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)
59
59
catch ( IOException e ) when ( ( e . HResult & 0x0000FFFF ) == 32 ) // ERROR_SHARING_VIOLATION: 0x80070020
60
60
{
61
61
// If retry failed 3 times. throw exception
62
- if ( ++ retryCount > 3 )
62
+ if ( retryCount > 3 )
63
63
throw ;
64
64
65
- var sleepDelay = 500 * retryCount ;
66
-
67
65
var message = FileLockCheck . GetLockingProcessNames ( path ) ;
68
66
if ( string . IsNullOrEmpty ( message ) )
69
67
message = "File is locked by other process" ;
70
68
69
+ var sleepDelay = 500 * retryCount ; // Retry immediately on first exception.
71
70
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 ;
73
74
goto Retry ;
74
75
}
75
76
}
You can’t perform that action at this time.
0 commit comments