Mercurial > rsstweet
comparison app/models/tweet.rb @ 146:7ca8aeba1a63
Try tracing where the failures happen
author | nanaya <me@nanaya.pro> |
---|---|
date | Wed, 13 Dec 2017 08:06:30 +0900 |
parents | c791b6bfeeda |
children | fd7344643903 |
comparison
equal
deleted
inserted
replaced
145:c791b6bfeeda | 146:7ca8aeba1a63 |
---|---|
18 def timeline | 18 def timeline |
19 if @timeline.nil? | 19 if @timeline.nil? |
20 raw = Rails.cache.fetch("timeline:v2:#{@twitter_id}", :expires_in => cache_expires_time) do | 20 raw = Rails.cache.fetch("timeline:v2:#{@twitter_id}", :expires_in => cache_expires_time) do |
21 client_try(:user_timeline, @twitter_id, TIMELINE_OPTIONS).tap do |data| | 21 client_try(:user_timeline, @twitter_id, TIMELINE_OPTIONS).tap do |data| |
22 if data[:result] == :ok | 22 if data[:result] == :ok |
23 if data[:data].any? && data[:data].first.user.id != @twitter_id | |
24 wrong_user = data[:data].first.user | |
25 Rails.logger.warn "Wrong timeline data. Requested: #{@twitter_id}, got: #{wrong_user.id} (#{wrong_user.name.printable})" | |
26 end | |
27 | |
23 data[:data] = data[:data].select do |tweet| | 28 data[:data] = data[:data].select do |tweet| |
24 tweet.retweeted_status.nil? || tweet.user.id != tweet.retweeted_status.user.id | 29 tweet.retweeted_status.nil? || tweet.user.id != tweet.retweeted_status.user.id |
25 end.map { |tweet| tweet.to_h } | 30 end.map { |tweet| tweet.to_h } |
26 end | 31 end |
27 end | 32 end |