use the new async methods for the pipe

This commit is contained in:
13xforever 2020-05-12 20:52:22 +05:00
parent fce31b2782
commit 60a7536141
6 changed files with 12 additions and 13 deletions

View File

@ -54,10 +54,10 @@ namespace CompatBot.EventHandlers.LogParsing.ArchiveHandlers
catch (Exception e)
{
Config.Log.Error(e, "Error filling the log pipe");
writer.Complete(e);
await writer.CompleteAsync(e);
return;
}
writer.Complete();
await writer.CompleteAsync();
}
}
}

View File

@ -41,10 +41,10 @@ namespace CompatBot.EventHandlers.LogParsing.ArchiveHandlers
catch (Exception e)
{
Config.Log.Error(e, "Error filling the log pipe");
writer.Complete(e);
await writer.CompleteAsync(e);
return;
}
writer.Complete();
await writer.CompleteAsync();
}
}
}

View File

@ -57,7 +57,7 @@ namespace CompatBot.EventHandlers.LogParsing.ArchiveHandlers
flushed = await writer.FlushAsync(cancellationToken).ConfigureAwait(false);
SourcePosition = statsStream.Position;
} while (read > 0 && !(flushed.IsCompleted || flushed.IsCanceled || cancellationToken.IsCancellationRequested));
writer.Complete();
await writer.CompleteAsync();
return;
}
SourcePosition = statsStream.Position;
@ -68,7 +68,7 @@ namespace CompatBot.EventHandlers.LogParsing.ArchiveHandlers
{
Config.Log.Error(e, "Error filling the log pipe");
}
writer.Complete();
await writer.CompleteAsync();
}
}
}

View File

@ -54,7 +54,7 @@ namespace CompatBot.EventHandlers.LogParsing.ArchiveHandlers
writer.Advance(read);
flushed = await writer.FlushAsync(cancellationToken).ConfigureAwait(false);
} while (read > 0 && !(flushed.IsCompleted || flushed.IsCanceled || cancellationToken.IsCancellationRequested));
writer.Complete();
await writer.CompleteAsync();
return;
}
Config.Log.Warn("No 7z entries that match the log criteria");
@ -63,7 +63,7 @@ namespace CompatBot.EventHandlers.LogParsing.ArchiveHandlers
{
Config.Log.Error(e, "Error filling the log pipe");
}
writer.Complete();
await writer.CompleteAsync();
}
}
}

View File

@ -57,7 +57,7 @@ namespace CompatBot.EventHandlers.LogParsing.ArchiveHandlers
flushed = await writer.FlushAsync(cancellationToken).ConfigureAwait(false);
SourcePosition = statsStream.Position;
} while (read > 0 && !(flushed.IsCompleted || flushed.IsCanceled || cancellationToken.IsCancellationRequested));
writer.Complete();
await writer.CompleteAsync();
return;
}
SourcePosition = statsStream.Position;
@ -68,8 +68,7 @@ namespace CompatBot.EventHandlers.LogParsing.ArchiveHandlers
{
Config.Log.Error(e, "Error filling the log pipe");
}
writer.Complete();
await writer.CompleteAsync();
}
}
}

View File

@ -55,7 +55,7 @@ namespace CompatBot.EventHandlers.LogParsing
await OnNewLineAsync(buffer.Slice(0, lineEnd.Value), result.Buffer, currentSectionLines, state).ConfigureAwait(false);
if (state.Error != LogParseState.ErrorCode.None)
{
reader.Complete();
await reader.CompleteAsync();
return state;
}
@ -88,7 +88,7 @@ namespace CompatBot.EventHandlers.LogParsing
} while (!(result.IsCompleted || result.IsCanceled || cancellationToken.IsCancellationRequested));
await TaskScheduler.WaitForClearTagAsync(state).ConfigureAwait(false);
state.ReadBytes = totalReadBytes;
reader.Complete();
await reader.CompleteAsync();
return state;
}