From 0bc8b96ea5a4bac928ef6e153dda162bfed1b452 Mon Sep 17 00:00:00 2001 From: Vincent Cloutier Date: Sat, 18 Mar 2023 20:48:23 -0400 Subject: [PATCH] made retwrieve followers more parallel --- .../Processors/RetrieveFollowersProcessor.cs | 5 ----- src/BirdsiteLive.Pipeline/StatusPublicationPipeline.cs | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/BirdsiteLive.Pipeline/Processors/RetrieveFollowersProcessor.cs b/src/BirdsiteLive.Pipeline/Processors/RetrieveFollowersProcessor.cs index 88a56a8..65357a9 100644 --- a/src/BirdsiteLive.Pipeline/Processors/RetrieveFollowersProcessor.cs +++ b/src/BirdsiteLive.Pipeline/Processors/RetrieveFollowersProcessor.cs @@ -30,11 +30,6 @@ 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); diff --git a/src/BirdsiteLive.Pipeline/StatusPublicationPipeline.cs b/src/BirdsiteLive.Pipeline/StatusPublicationPipeline.cs index 5638a96..97c4bf6 100644 --- a/src/BirdsiteLive.Pipeline/StatusPublicationPipeline.cs +++ b/src/BirdsiteLive.Pipeline/StatusPublicationPipeline.cs @@ -45,7 +45,7 @@ namespace BirdsiteLive.Pipeline { BoundedCapacity = 1, CancellationToken = ct }); var retrieveTweetsBlock = new TransformBlock(async x => await _retrieveTweetsProcessor.ProcessAsync(x, ct), standardBlockOptions ); var retrieveTweetsBufferBlock = new BufferBlock(new DataflowBlockOptions { BoundedCapacity = 20, CancellationToken = ct }); - var retrieveFollowersBlock = new TransformManyBlock(async x => await _retrieveFollowersProcessor.ProcessAsync(x, ct), standardBlockOptions); + var retrieveFollowersBlock = new TransformManyBlock(async x => await _retrieveFollowersProcessor.ProcessAsync(x, ct), new ExecutionDataflowBlockOptions { BoundedCapacity = 1 } ); var retrieveFollowersBufferBlock = new BufferBlock(new DataflowBlockOptions { BoundedCapacity = 500, CancellationToken = ct }); var sendTweetsToFollowersBlock = new ActionBlock(async x => await _sendTweetsToFollowersProcessor.ProcessAsync(x, ct), standardBlockOptions);