made RetrieveFollowersProcessor more parallel
This commit is contained in:
parent
dc34228659
commit
6b6a943294
1 changed files with 8 additions and 3 deletions
|
@ -20,12 +20,17 @@ namespace BirdsiteLive.Pipeline.Processors
|
||||||
|
|
||||||
public async Task<IEnumerable<UserWithDataToSync>> ProcessAsync(UserWithDataToSync[] userWithTweetsToSyncs, CancellationToken ct)
|
public async Task<IEnumerable<UserWithDataToSync>> ProcessAsync(UserWithDataToSync[] userWithTweetsToSyncs, CancellationToken ct)
|
||||||
{
|
{
|
||||||
//TODO multithread this
|
List<Task> todo = new List<Task>();
|
||||||
foreach (var user in userWithTweetsToSyncs)
|
foreach (var user in userWithTweetsToSyncs)
|
||||||
{
|
{
|
||||||
var followers = await _followersDal.GetFollowersAsync(user.User.Id);
|
var t = Task.Run(
|
||||||
user.Followers = followers;
|
async() => {
|
||||||
|
var followers = await _followersDal.GetFollowersAsync(user.User.Id);
|
||||||
|
user.Followers = followers;
|
||||||
|
});
|
||||||
|
todo.Add(t);
|
||||||
}
|
}
|
||||||
|
await Task.WhenAll(todo);
|
||||||
|
|
||||||
return userWithTweetsToSyncs;
|
return userWithTweetsToSyncs;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue