Skip to content

Commit

Permalink
Forward cancellation token
Browse files Browse the repository at this point in the history
  • Loading branch information
nurhafiz committed May 1, 2024
1 parent 7d59607 commit d3f920a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/Toimik.CommonCrawl/Streamer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public async IAsyncEnumerable<Result> Stream(
if (urlSegmentOffset == 0)
{
index = 0;
dataUrl = await reader.ReadLineAsync().ConfigureAwait(false);
dataUrl = await reader.ReadLineAsync(cancellationToken).ConfigureAwait(false);
}
else
{
Expand All @@ -100,10 +100,10 @@ public async IAsyncEnumerable<Result> Stream(

for (index = 0; index < urlSegmentOffset; index++)
{
await reader.ReadLineAsync().ConfigureAwait(false);
await reader.ReadLineAsync(cancellationToken).ConfigureAwait(false);
}

dataUrl = await reader.ReadLineAsync().ConfigureAwait(false);
dataUrl = await reader.ReadLineAsync(cancellationToken).ConfigureAwait(false);
if (dataUrl == null)
{
throw new ArgumentException($"Invalid {nameof(urlSegmentOffset)}.");
Expand All @@ -130,7 +130,7 @@ public async IAsyncEnumerable<Result> Stream(

// Stream the rest of the records from the rest of the segments
string? line;
while ((line = await reader.ReadLineAsync().ConfigureAwait(false)) != null)
while ((line = await reader.ReadLineAsync(cancellationToken).ConfigureAwait(false)) != null)
{
dataUrl = $"https://{hostname}/{line}";
await foreach (Result result in Stream(new Segment<string>(index, dataUrl), cancellationToken).ConfigureAwait(false))
Expand Down
4 changes: 2 additions & 2 deletions src/Toimik.CommonCrawl/Toimik.CommonCrawl.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<AssemblyName>Toimik.CommonCrawl</AssemblyName>
<PackageVersion>0.5.2</PackageVersion>
<PackageVersion>0.5.3</PackageVersion>
<Authors>Nurhafiz</Authors>
<Version>0.5.2</Version>
<Version>0.5.3</Version>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Company>Toimik</Company>
<Description>
Expand Down

0 comments on commit d3f920a

Please sign in to comment.