@@ -15,6 +15,7 @@ namespace Coverlet.Core.Helpers
15
15
{
16
16
internal class InstrumentationHelper : IInstrumentationHelper
17
17
{
18
+ private const int RetryAttempts = 12 ;
18
19
private readonly ConcurrentDictionary < string , string > _backupList = new ConcurrentDictionary < string , string > ( ) ;
19
20
private readonly IRetryHelper _retryHelper ;
20
21
private readonly IFileSystem _fileSystem ;
@@ -216,7 +217,7 @@ public virtual void RestoreOriginalModule(string module, string identifier)
216
217
_fileSystem . Copy ( backupPath , module , true ) ;
217
218
_fileSystem . Delete ( backupPath ) ;
218
219
_backupList . TryRemove ( module , out string _ ) ;
219
- } , retryStrategy , 10 ) ;
220
+ } , retryStrategy , RetryAttempts ) ;
220
221
221
222
_retryHelper . Retry ( ( ) =>
222
223
{
@@ -227,7 +228,7 @@ public virtual void RestoreOriginalModule(string module, string identifier)
227
228
_fileSystem . Delete ( backupSymbolPath ) ;
228
229
_backupList . TryRemove ( symbolFile , out string _ ) ;
229
230
}
230
- } , retryStrategy , 10 ) ;
231
+ } , retryStrategy , RetryAttempts ) ;
231
232
}
232
233
233
234
public virtual void RestoreOriginalModules ( )
@@ -244,16 +245,14 @@ public virtual void RestoreOriginalModules()
244
245
_fileSystem . Copy ( backupPath , key , true ) ;
245
246
_fileSystem . Delete ( backupPath ) ;
246
247
_backupList . TryRemove ( key , out string _ ) ;
247
- } , retryStrategy , 10 ) ;
248
+ } , retryStrategy , RetryAttempts ) ;
248
249
}
249
250
}
250
251
251
252
public void DeleteHitsFile ( string path )
252
253
{
253
- // Retry hitting the hits file - retry up to 10 times, since the file could be locked
254
- // See: https://github.com/tonerdo/coverlet/issues/25
255
254
var retryStrategy = CreateRetryStrategy ( ) ;
256
- _retryHelper . Retry ( ( ) => _fileSystem . Delete ( path ) , retryStrategy , 10 ) ;
255
+ _retryHelper . Retry ( ( ) => _fileSystem . Delete ( path ) , retryStrategy , RetryAttempts ) ;
257
256
}
258
257
259
258
public bool IsValidFilterExpression ( string filter )
0 commit comments