diff --git a/src/BirdsiteLive.Pipeline/Processors/RetrieveTweetsProcessor.cs b/src/BirdsiteLive.Pipeline/Processors/RetrieveTweetsProcessor.cs index 2b29ce3..4d76f3b 100644 --- a/src/BirdsiteLive.Pipeline/Processors/RetrieveTweetsProcessor.cs +++ b/src/BirdsiteLive.Pipeline/Processors/RetrieveTweetsProcessor.cs @@ -39,7 +39,7 @@ namespace BirdsiteLive.Pipeline.Processors foreach (var userWtData in syncTwitterUsers) { var user = userWtData.User; - var tweets = RetrieveNewTweets(user); + var tweets = await RetrieveNewTweets(user); _logger.LogInformation("Got " + tweets.Length + " tweets from user " + user.Acct); if (tweets.Length > 0 && user.LastTweetPostedId != -1) { @@ -64,16 +64,16 @@ namespace BirdsiteLive.Pipeline.Processors return usersWtTweets.ToArray(); } - private ExtractedTweet[] RetrieveNewTweets(SyncTwitterUser user) + private async Task RetrieveNewTweets(SyncTwitterUser user) { var tweets = new ExtractedTweet[0]; try { if (user.LastTweetPostedId == -1) - tweets = _twitterTweetsService.GetTimeline(user.Acct, 1); + tweets = await _twitterTweetsService.GetTimelineAsync(user.Acct, 1); else - tweets = _twitterTweetsService.GetTimeline(user.Acct, 200, user.LastTweetSynchronizedForAllFollowersId); + tweets = await _twitterTweetsService.GetTimelineAsync(user.Acct, 200, user.LastTweetSynchronizedForAllFollowersId); } catch (Exception e) { diff --git a/src/BirdsiteLive.Twitter/TwitterTweetsService.cs b/src/BirdsiteLive.Twitter/TwitterTweetsService.cs index 2746293..a615d23 100644 --- a/src/BirdsiteLive.Twitter/TwitterTweetsService.cs +++ b/src/BirdsiteLive.Twitter/TwitterTweetsService.cs @@ -18,8 +18,7 @@ namespace BirdsiteLive.Twitter public interface ITwitterTweetsService { Task GetTweetAsync(long statusId); - ExtractedTweet GetTweet(long statusId); - ExtractedTweet[] GetTimeline(string username, int nberTweets, long fromTweetId = -1); + Task GetTimelineAsync(string username, int nberTweets, long fromTweetId = -1); } public class TwitterTweetsService : ITwitterTweetsService @@ -41,10 +40,6 @@ namespace BirdsiteLive.Twitter #endregion - public ExtractedTweet GetTweet(long statusId) - { - return GetTweetAsync(statusId).Result; - } public async Task GetTweetAsync(long statusId) { @@ -79,10 +74,6 @@ namespace BirdsiteLive.Twitter } } - public ExtractedTweet[] GetTimeline(string username, int nberTweets, long fromTweetId = -1) - { - return GetTimelineAsync(username, nberTweets, fromTweetId).Result; - } public async Task GetTimelineAsync(string username, int nberTweets, long fromTweetId = -1) { if (nberTweets < 5)