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)
|
||||
{
|
||||
//TODO multithread this
|
||||
List<Task> todo = new List<Task>();
|
||||
foreach (var user in userWithTweetsToSyncs)
|
||||
{
|
||||
var followers = await _followersDal.GetFollowersAsync(user.User.Id);
|
||||
user.Followers = followers;
|
||||
var t = Task.Run(
|
||||
async() => {
|
||||
var followers = await _followersDal.GetFollowersAsync(user.User.Id);
|
||||
user.Followers = followers;
|
||||
});
|
||||
todo.Add(t);
|
||||
}
|
||||
await Task.WhenAll(todo);
|
||||
|
||||
return userWithTweetsToSyncs;
|
||||
}
|
||||
|
|
Reference in a new issue