limit parallel postgres requests

This commit is contained in:
Vincent Cloutier 2023-03-17 16:31:52 -04:00
parent 240dfd1902
commit 5dcb1199c7
2 changed files with 8 additions and 1 deletions

View file

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using BirdsiteLive.DAL.Contracts;
@ -29,7 +30,13 @@ namespace BirdsiteLive.Pipeline.Processors
user.Followers = followers;
});
todo.Add(t);
if (todo.Count(x => !x.IsCompleted) >= 25)
{
await Task.WhenAny(todo);
}
}
await Task.WhenAll(todo);
return userWithTweetsToSyncs;

View file

@ -6,7 +6,7 @@
<ItemGroup>
<PackageReference Include="Dapper" Version="2.0.123" />
<PackageReference Include="Npgsql" Version="7.0.1" />
<PackageReference Include="Npgsql" Version="7.0.2" />
</ItemGroup>
<ItemGroup>