-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
there are more queues in production, we need to slow down the changes
- Loading branch information
Showing
1 changed file
with
3 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,7 @@ def get_crossref_member_id(id, options={}) | |
# return "crossref.citations" unless doi.present? | ||
|
||
url = "https://api.crossref.org/works/#{Addressable::URI.encode(doi)}[email protected]" | ||
sleep(0.03) # to avoid crossref rate limitting | ||
sleep(0.24) # to avoid crossref rate limitting | ||
response = Maremma.get(url, host: true) | ||
logger.info "[Crossref Response] [#{response.status}] for DOI #{doi} metadata" | ||
return "" if response.status == 404 ### for cases when DOI is not in the crossreaf api | ||
|
@@ -55,14 +55,14 @@ def get_crossref_member_id(id, options={}) | |
|
||
def cached_get_doi_ra(doi) | ||
Rails.cache.fetch("ras/#{doi}") do | ||
puts "did not find key in cache, executing block ..." | ||
puts "#{doi} [RA] did not find key in cache, executing block ..." | ||
get_doi_ra(doi) | ||
end | ||
end | ||
|
||
def cached_get_crossref_member_id(doi) | ||
Rails.cache.fetch("members_ids/#{doi}") do | ||
puts "did not find key in cache, executing block ..." | ||
puts "#{doi} [Crossref Member] did not find key in cache, executing block ..." | ||
get_crossref_member_id(doi) | ||
end | ||
end | ||
|