Merge branch 'master' of https://github.com/microsoft/Recurring-Integrations-Scheduler
This commit is contained in:
Коммит
aa86239565
|
@ -34,16 +34,22 @@ namespace RecurringIntegrationsScheduler.Common.Helpers
|
|||
/// </summary>
|
||||
/// <param name="filePath">File path</param>
|
||||
/// <returns>Stream</returns>
|
||||
public static Stream Read(string filePath)
|
||||
public static Stream Read(string filePath, FileShare fileShare = FileShare.ReadWrite)
|
||||
{
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
return new FileStream(filePath,
|
||||
FileMode.Open,
|
||||
FileAccess.ReadWrite,
|
||||
FileShare.ReadWrite,
|
||||
4096,
|
||||
true);
|
||||
try
|
||||
{
|
||||
return new FileStream(filePath,
|
||||
FileMode.Open,
|
||||
FileAccess.ReadWrite,
|
||||
fileShare,
|
||||
4096,
|
||||
true);
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -194,7 +194,7 @@ namespace RecurringIntegrationsScheduler.Job
|
|||
}
|
||||
fileCount++;
|
||||
|
||||
var sourceStream = _retryPolicyForIo.Execute(() => FileOperationsHelper.Read(dataMessage.FullPath));
|
||||
var sourceStream = _retryPolicyForIo.Execute(() => FileOperationsHelper.Read(dataMessage.FullPath, FileShare.None));
|
||||
if (sourceStream == null) continue;//Nothing to do here
|
||||
|
||||
sourceStream.Seek(0, SeekOrigin.Begin);
|
||||
|
|
Загрузка…
Ссылка в новой задаче