Skip to content

Commit

Permalink
(GH-368) Add missing 'limit' and 'offset' parameters to IpAddresses.G…
Browse files Browse the repository at this point in the history
…etUnassignedAsync
  • Loading branch information
Jericho committed Jan 11, 2022
1 parent 4c6a9c0 commit cb28017
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Source/StrongGrid/Extensions/Public.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1158,10 +1158,10 @@ public static async Task<IpAddress[]> GetUnassignedAsync(this IIpAddresses ipAdd
while (true)
{
var allIpAddresses = await ipAddresses.GetAllAsync(limit: Utils.MaxSendGridPagingLimit, offset: currentOffset, cancellationToken: cancellationToken).ConfigureAwait(false);
unassignedIpAddresses.AddRange(allIpAddresses.Where(ip => ip.Pools == null || !ip.Pools.Any()));
unassignedIpAddresses.AddRange(allIpAddresses.Records.Where(ip => ip.Pools == null || !ip.Pools.Any()));

if (unassignedIpAddresses.Count >= offset + limit) break;
if (allIpAddresses.Length < Utils.MaxSendGridPagingLimit) break;
if (allIpAddresses.Next == null) break;

currentOffset += Utils.MaxSendGridPagingLimit;
}
Expand Down

0 comments on commit cb28017

Please sign in to comment.