changed some magic

This commit is contained in:
Vincent Cloutier 2022-12-29 13:02:38 -05:00
parent 59ea905e43
commit b1b8b676b9
6 changed files with 7 additions and 7 deletions

View file

@ -60,7 +60,7 @@ namespace BirdsiteLive.Pipeline.Processors
await _twitterUserDal.UpdateTwitterUserAsync(user.Id, user.LastTweetPostedId, user.LastTweetSynchronizedForAllFollowersId, user.FetchingErrorCount, now);
}
await Task.Delay(1500);
await Task.Delay(750);
}
return usersWtTweets.ToArray();

View file

@ -47,7 +47,7 @@ namespace BirdsiteLive.Pipeline
var twitterUserToRefreshBlock = new TransformBlock<SyncTwitterUser[], UserWithDataToSync[]>(async x => await _refreshTwitterUserStatusProcessor.ProcessAsync(x, ct));
var twitterUsersBufferBlock = new BufferBlock<UserWithDataToSync[]>(new DataflowBlockOptions { BoundedCapacity = 1, CancellationToken = ct });
var retrieveTweetsBlock = new TransformBlock<UserWithDataToSync[], UserWithDataToSync[]>(async x => await _retrieveTweetsProcessor.ProcessAsync(x, ct));
var retrieveTweetsBufferBlock = new BufferBlock<UserWithDataToSync[]>(new DataflowBlockOptions { BoundedCapacity = 3, CancellationToken = ct });
var retrieveTweetsBufferBlock = new BufferBlock<UserWithDataToSync[]>(new DataflowBlockOptions { BoundedCapacity = 2, CancellationToken = ct });
var retrieveFollowersBlock = new TransformManyBlock<UserWithDataToSync[], UserWithDataToSync>(async x => await _retrieveFollowersProcessor.ProcessAsync(x, ct));
var retrieveFollowersBufferBlock = new BufferBlock<UserWithDataToSync>(new DataflowBlockOptions { BoundedCapacity = 20, CancellationToken = ct });
var sendTweetsToFollowersBlock = new TransformBlock<UserWithDataToSync, UserWithDataToSync>(async x => await _sendTweetsToFollowersProcessor.ProcessAsync(x, ct), new ExecutionDataflowBlockOptions { MaxDegreeOfParallelism = 5, CancellationToken = ct });

View file

@ -23,9 +23,9 @@ namespace BirdsiteLive.Twitter
//Priority on removing when reaching size limit (memory pressure)
.SetPriority(CacheItemPriority.Low)
// Keep in cache for this time, reset time if accessed.
.SetSlidingExpiration(TimeSpan.FromHours(24))
.SetSlidingExpiration(TimeSpan.FromMinutes(10))
// Remove from cache after this time, regardless of sliding expiration
.SetAbsoluteExpiration(TimeSpan.FromDays(7));
.SetAbsoluteExpiration(TimeSpan.FromDays(1));
#region Ctor
public CachedTwitterUserService(ITwitterUserService twitterService, InstanceSettings settings)

View file

@ -39,7 +39,7 @@ namespace BirdsiteLive.Twitter.Tools
_logger = logger;
aTimer = new System.Timers.Timer();
aTimer.Interval = 5 * 60 * 1000;
aTimer.Interval = 2 * 60 * 1000;
aTimer.Elapsed += async (sender, e) => await RefreshCred();
aTimer.Start();

View file

@ -150,11 +150,11 @@ namespace BirdsiteLive.Twitter
try
{
var extractedTweet = await Extract(tweet);
extractedTweets.Add(extractedTweet);
if (extractedTweet.Id == fromTweetId)
break;
extractedTweets.Add(extractedTweet);
}
catch (Exception e)
{

View file

@ -41,7 +41,7 @@ namespace BirdsiteLive.ActivityPub.Tests
{
var tweets = await _tweetService.GetTimelineAsync("kobebryant", 100, 1218020971346444288);
Assert.AreEqual(tweets[0].MessageContent, "Continuing to move the game forward @KingJames. Much respect my brother 💪🏾 #33644");
Assert.AreEqual(tweets.Length, 9);
Assert.AreEqual(tweets.Length, 8);
}