Skip to content

Commit

Permalink
return to use array instead of IEnumerable
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm360 committed Oct 5, 2024
1 parent f1e4ec8 commit 1982df2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/BeeNet.Core/Models/ChunkUploaderWebSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// If not, see <https://www.gnu.org/licenses/>.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.WebSockets;
using System.Threading;
Expand Down Expand Up @@ -76,13 +75,13 @@ public virtual async Task SendChunkAsync(
}

public virtual async Task SendChunksAsync(
IEnumerable<SwarmChunk> chunks,
SwarmChunk[] chunkBatch,
Action<int>? onChunkBatchSent = null,
CancellationToken cancellationToken = default)
{
ArgumentNullException.ThrowIfNull(chunks, nameof(chunks));
ArgumentNullException.ThrowIfNull(chunkBatch, nameof(chunkBatch));

foreach (var (chunk, i) in chunks.Select((c, i) => (c, i)))
foreach (var (chunk, i) in chunkBatch.Select((c, i) => (c, i)))
{
await SendChunkAsync(chunk, cancellationToken).ConfigureAwait(false);
onChunkBatchSent?.Invoke(i + 1);
Expand Down

0 comments on commit 1982df2

Please sign in to comment.