limit parallel postgres requests
This commit is contained in:
parent
240dfd1902
commit
5dcb1199c7
2 changed files with 8 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using BirdsiteLive.DAL.Contracts;
|
using BirdsiteLive.DAL.Contracts;
|
||||||
|
@ -29,7 +30,13 @@ namespace BirdsiteLive.Pipeline.Processors
|
||||||
user.Followers = followers;
|
user.Followers = followers;
|
||||||
});
|
});
|
||||||
todo.Add(t);
|
todo.Add(t);
|
||||||
|
|
||||||
|
if (todo.Count(x => !x.IsCompleted) >= 25)
|
||||||
|
{
|
||||||
|
await Task.WhenAny(todo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await Task.WhenAll(todo);
|
await Task.WhenAll(todo);
|
||||||
|
|
||||||
return userWithTweetsToSyncs;
|
return userWithTweetsToSyncs;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Dapper" Version="2.0.123" />
|
<PackageReference Include="Dapper" Version="2.0.123" />
|
||||||
<PackageReference Include="Npgsql" Version="7.0.1" />
|
<PackageReference Include="Npgsql" Version="7.0.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
Loading…
Add table
Reference in a new issue