diff app/models/tweet.rb @ 88:cf9a9ce2d034

Increase cache timeout to ease up load ;_;
author nanaya <me@myconan.net>
date Tue, 28 Jun 2016 02:38:27 +0900
parents 5bfc986200db
children ff5557f9902c
line wrap: on
line diff
--- a/app/models/tweet.rb	Mon Jun 27 06:01:39 2016 +0900
+++ b/app/models/tweet.rb	Tue Jun 28 02:38:27 2016 +0900
@@ -4,7 +4,7 @@
 
     begin
       @timeline ||=
-        Rails.cache.fetch({ :timeline => @twitter_id }, :expires_in => 5.minutes) do
+        Rails.cache.fetch({ :timeline => @twitter_id }, :expires_in => 20.minutes) do
           @client.user_timeline(@twitter_id, :count => 40, :exclude_replies => false, :include_rts => true)
         end
     rescue Twitter::Error::TooManyRequests
@@ -24,7 +24,7 @@
       if timeline.any?
         timeline.first.user
       else
-        Rails.cache.fetch({ :user => @twitter_id }, :expires_in => 5.minutes) do
+        Rails.cache.fetch({ :user => @twitter_id }, :expires_in => 20.minutes) do
           @client.user(@twitter_id)
         end
       end