Browse files

Only attempt to fetch active auth users

  • Loading branch information...
1 parent 21cf104 commit 60dc86858bd885594a68ecb019e7de90f3996ec1 @rwdaigle committed Nov 7, 2012
Showing with 2 additions and 1 deletion.
  1. +1 −1 app/models/gist_fetcher.rb
  2. +1 −0 app/models/user.rb
View
2 app/models/gist_fetcher.rb
@@ -6,7 +6,7 @@ def fetch
period = ENV['FETCH_INTERVAL_MINS'] ? ENV['FETCH_INTERVAL_MINS'].to_i : 1440
since = period.minutes.ago
log({ns: self, fn: __method__}, since: since) do
- User.last_fetched_before(since).pluck(:id).each do |user_id|
+ User.last_fetched_before(since).active_auth.pluck(:id).each do |user_id|
QC.enqueue("GistFetcher.fetch_gists", user_id)
end
end
View
1 app/models/user.rb
@@ -6,6 +6,7 @@ class User < ActiveRecord::Base
has_many :files, :through => :gists
scope :last_fetched_before, lambda { |since| where(["last_gh_fetch < ? OR last_gh_fetch IS NULL", since])}
+ scope :active_auth, where(gh_auth_active: true)
class << self

0 comments on commit 60dc868

Please sign in to comment.