コード例 #1
0
        private async Task HandleTweet(DB.TweetsContext tweetsDB, DB.Tweet tweet)
        {
            try
            {
                var t = await tweetsDB.AddTweetWithCheckAsync(tweet);

                if (t == null)
                {
                    logger.LogDebug($"Duplicate - id: {tweet.ID}");
                    return;
                }
                logger.LogDebug($"Tweet added - id: {t.Entity.ID} @{t.Entity.Location}");
            }
            catch (Exception e)
            {
                logger.LogError(e, "Error during background tweet handling");
            }
        }
コード例 #2
0
ファイル: TweetProvider.cs プロジェクト: tapin13/twitter
        private void AddTweet(TweetReceivedEventArgs e)
        {
            var location = GetLocation(e.Tweet.Coordinates);

            if (location == null)
            {
                return;
            }

            var tweet = new DB.Tweet
            {
                ID       = e.Tweet.Id,
                Location = location as Point,
                Data     = e.Json
            };

            tweets.Add(tweet);
        }