Skip to content
Browse files

Update gist fetcher to use new 'since' parameter supported by GH API

  • Loading branch information...
1 parent 6196609 commit c5b5a16601825f5d7549ff7e1ff38089a865a9fa @rwdaigle committed
Showing with 4 additions and 5 deletions.
  1. +4 −5 app/models/gist_fetcher.rb
View
9 app/models/gist_fetcher.rb
@@ -18,16 +18,15 @@ def fetch_gists(user_id)
gh_client(user) do |gh|
log({ns: self, fn: __method__, measure: true}, user) do
- gh.gists.each do |gh_gist|
+ gh.gists(nil, since: (user.last_gh_fetch ? user.last_gh_fetch.iso8601.to_s : nil)).each do |gh_gist|
Gist.import(gh_gist)
- end
- user.gists.pluck(:gh_id).each do |gh_gist_id|
- QC.enqueue("GistFetcher.fetch_gist_files", user_id, gh_gist_id)
+ QC.enqueue("GistFetcher.fetch_gist_files", user_id, gh_gist.id)
end
end
QC.enqueue("User.refresh_index", user_id)
- QC.enqueue("User.fetched!", user_id)
end
+
+ user.fetched! # If gist imports fail, this could cause gaps in updated gists...
end
def fetch_gist_files(user_id, gh_gist_id)

0 comments on commit c5b5a16

Please sign in to comment.
Something went wrong with that request. Please try again.