diff --git a/app/controllers/api/v1/gab_trends_controller.rb b/app/controllers/api/v1/gab_trends_controller.rb index 4ef0ddbb..88b84d04 100644 --- a/app/controllers/api/v1/gab_trends_controller.rb +++ b/app/controllers/api/v1/gab_trends_controller.rb @@ -10,7 +10,7 @@ class Api::V1::GabTrendsController < Api::BaseController if type == 'feed' body = Redis.current.get("gabtrends:feed") - if body.nil? + if body.nil? || body.empty? Request.new(:get, "https://trends.gab.com/trend-feed/json").perform do |res| if res.code == 200 body = res.body_with_limit @@ -26,12 +26,12 @@ class Api::V1::GabTrendsController < Api::BaseController elsif type == 'partner' body = Redis.current.get("gabtrends:partner") - if body.nil? + if body.nil? || body.empty? Request.new(:get, "https://trends.gab.com/partner").perform do |res| if res.code == 200 body = res.body_with_limit Redis.current.set("gabtrends:partner", body) - Redis.current.expire("gabtrends:partner", 1.minute.seconds) + Redis.current.expire("gabtrends:partner", 1.minute.seconds) else body = nil end diff --git a/app/controllers/api/v1/shop_controller.rb b/app/controllers/api/v1/shop_controller.rb index 80dbcd94..81d6b644 100644 --- a/app/controllers/api/v1/shop_controller.rb +++ b/app/controllers/api/v1/shop_controller.rb @@ -12,7 +12,7 @@ class Api::V1::ShopController < Api::BaseController if type == 'featured_products' body = Redis.current.get("gabstore:featuredproducts") - if body.nil? + if body.nil? || body.empty? Request.new(:get, "https://shop.dissenter.com/product/group/json").perform do |res| if res.code == 200 body = res.body_with_limit