Commit 10de703b authored by HankG's avatar HankG

Add console debugging for timeline management and TwitterConnector

parent ef0e582b
......@@ -63,5 +63,10 @@ namespace MySocialPortalLib.Model
{
return (Id != null ? Id.GetHashCode(StringComparison.InvariantCulture) : 0);
}
public override string ToString()
{
return $"{TimelineName}: {IntervalStart} -> {IntervalStop}";
}
}
}
\ No newline at end of file
......@@ -51,7 +51,9 @@ namespace MySocialPortalLib.Service.SocialMediaConnectors
public IEnumerable<Post> GetOlderHomeTimeline(int maxPosts = DefaultMaxPosts)
{
Console.WriteLine("Called GetOlderHomeTimeline");
var newInterval = TimelineManager.GetPreviousSamplingInterval(HomeTimelineName, EarliestTweetValue, LatestTweetValue);
Console.WriteLine($"Interval to query on returned: {newInterval}");
if (newInterval != null && newInterval.IntervalStop != ulong.MaxValue)
{
newInterval.IntervalStop -= 1;
......@@ -164,12 +166,15 @@ namespace MySocialPortalLib.Service.SocialMediaConnectors
private IList<Post> PullHomeTweets(TimelineInterval interval, int maxPosts)
{
IQueryable<Status> query;
Console.WriteLine($"PullHomeTweets {maxPosts} #posts for {interval}");
if (interval.IntervalStop == ulong.MaxValue)
{
Console.WriteLine("Pulling home tweets with no upper bound");
query = GetNoUpperHomeStatusQuery(interval, maxPosts);
}
else
{
Console.WriteLine("Pulling upper and lower bound tweets");
query = GetUpperLowerHomeStatusQuery(interval, maxPosts);
}
......@@ -201,6 +206,7 @@ namespace MySocialPortalLib.Service.SocialMediaConnectors
List<Status> tweets = query.ToList();
Console.WriteLine($"{tweets.Count} tweets returned");
if (tweets.Count == 0)
{
return posts;
......@@ -216,12 +222,15 @@ namespace MySocialPortalLib.Service.SocialMediaConnectors
{
var earliestTweet = tweets.Min(t => t.StatusID);
var latestTweet = tweets.Max(t => t.StatusID);
Console.WriteLine($"TweetIDs range: {earliestTweet} to {latestTweet}");
newInterval.IntervalStop = latestTweet;
if (tweets.Count == maxPosts)
{
Console.WriteLine("Max posts returned therefore setting interval start as well");
newInterval.IntervalStart = earliestTweet;
}
Console.WriteLine($"Updated interval: {newInterval}");
TimelineManager.UpdateRequestedInterval(newInterval);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment