This repository has been archived on 2023-05-27. You can view files and clone it, but cannot push or open issues or pull requests.
BirdsiteLIVE/src/BirdsiteLive.Pipeline/Processors/RetrieveFollowersProcessor.cs
Sam Therapy e2ec4a5857
Some checks failed
continuous-integration/drone Build is failing
format things, I think
also prepare pipelines and stuff

Signed-off-by: Sam Therapy <sam@samtherapy.net>
2022-11-15 17:25:54 +01:00

38 lines
1 KiB
C#

using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using BirdsiteLive.DAL.Contracts;
using BirdsiteLive.Pipeline.Contracts;
using BirdsiteLive.Pipeline.Models;
namespace BirdsiteLive.Pipeline.Processors
{
public class RetrieveFollowersProcessor : IRetrieveFollowersProcessor
{
private readonly IFollowersDal _followersDal;
#region Ctor
public RetrieveFollowersProcessor(IFollowersDal followersDal)
{
_followersDal = followersDal;
}
#endregion
public async Task<IEnumerable<UserWithDataToSync>> ProcessAsync(
UserWithDataToSync[] userWithTweetsToSyncs,
CancellationToken ct
)
{
//TODO multithread this
foreach (var user in userWithTweetsToSyncs)
{
var followers = await _followersDal.GetFollowersAsync(user.User.Id);
user.Followers = followers;
}
return userWithTweetsToSyncs;
}
}
}