Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

prevent seeding data on every request

  • Loading branch information...
commit 3a20135da5f115d50ccac6d717daaca062397836 1 parent dc0e474
@akshayrawat authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 app/controllers/welcome_controller.rb
View
6 app/controllers/welcome_controller.rb
@@ -1,7 +1,7 @@
class WelcomeController < ApplicationController
def index
- seed_data if no_data
+ seed_data if stale?
redirect_to dj_mon_url
end
@@ -18,8 +18,8 @@ def seed_data
12.times { |i| Email.new.delay(priority: i).deliver }
end
- def no_data
- DjMon::DjReport.dj_counts.values.any?(&:zero?)
+ def stale?
+ Delayed::Job.where('updated_at > ?', 1.hour.ago).present?
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.