mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-28 15:02:35 +01:00
Merge pull request #7144 from ivandrofly/feature/save-retry
Replace magic numbers with named constants
This commit is contained in:
commit
0719c7e412
@ -225,7 +225,9 @@ namespace UpdateAssemblyInfo
|
|||||||
|
|
||||||
private static void SaveWithRetry(string fileName, string content)
|
private static void SaveWithRetry(string fileName, string content)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 10; i++)
|
const int maxRetries = 10;
|
||||||
|
var delayBetweenRetries = TimeSpan.FromMilliseconds(10);
|
||||||
|
for (var i = 0; i <= maxRetries; i++)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -234,10 +236,14 @@ namespace UpdateAssemblyInfo
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
System.Threading.Thread.Sleep(10);
|
if (i == maxRetries)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
System.Threading.Thread.Sleep(delayBetweenRetries);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
File.WriteAllText(fileName, content, Encoding.UTF8);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void GetRepositoryVersions(out VersionInfo currentRepositoryVersion, out VersionInfo latestRepositoryVersion)
|
private static void GetRepositoryVersions(out VersionInfo currentRepositoryVersion, out VersionInfo latestRepositoryVersion)
|
||||||
|
@ -109,7 +109,7 @@ namespace UpdateLanguageFiles
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
System.Threading.Thread.Sleep(10);
|
System.Threading.Thread.Sleep(delayBetweenRetries);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user