Skip to content

Commit

Permalink
Move all rate-limiting to base request-building fxn #117
Browse files Browse the repository at this point in the history
  • Loading branch information
dwinter committed Nov 21, 2017
1 parent 8a7c7b5 commit 0c3a63f
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 6 deletions.
2 changes: 0 additions & 2 deletions R/entrez_fetch.r
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ entrez_fetch <- function(db, id=NULL, web_history=NULL, rettype, retmode="", par
}
args <- c(list("efetch", db=db, rettype=rettype, config=config, ...), identifiers)
records <- do.call(make_entrez_query, args)
#NCBI limits requests to three per second
Sys.sleep(0.33)
if(parsed){
#At the moment, this is just a long-winded way to call
#XML::xmlTreeParse, but we already use this approach to parse
Expand Down
1 change: 0 additions & 1 deletion R/entrez_global_query.r
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ entrez_global_query <- function(term, config=NULL, ...){
res <- as.numeric(xpathSApply(record, path, xmlValue))
}
#NCBI limits requests to three per second
Sys.sleep(0.33)
res <- structure(sapply(db_names, get_Ids), names=db_names)
return(res)
}
1 change: 0 additions & 1 deletion R/entrez_link.r
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ entrez_link <- function(dbfrom, web_history=NULL, id=NULL, db=NULL, cmd='neighbo
}
response <- do.call(make_entrez_query,args)
record <- parse_response(response, 'xml')
Sys.sleep(0.33)
res <- parse_elink(record, cmd=cmd, by_id=by_id)
if(!is.null(id) & by_id){
if(length(res) != length(id)){
Expand Down
2 changes: 0 additions & 2 deletions R/entrez_post.r
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ entrez_post <- function(db, id=NULL, web_history=NULL, config=NULL, ...){
result <- xpathApply(record, "/ePostResult/*", XML::xmlValue)
names(result) <- c("QueryKey", "WebEnv")
class(result) <- c("web_history", "list")
#NCBI limits requests to three per second
Sys.sleep(0.33)
return(result)
}

Expand Down

0 comments on commit 0c3a63f

Please sign in to comment.