Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rate limit for deleting files #67

Closed
ThierryO opened this issue Jan 10, 2022 · 4 comments
Closed

Rate limit for deleting files #67

ThierryO opened this issue Jan 10, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@ThierryO
Copy link

When creating a new version with delete_latest_files = TRUE, I'm hitting a Zenodo rate limit (100 deletions per 1 min)

Maybe slow the loop down by adding Sys.sleep(0.6) to

invisible(lapply(out$files, function(x){ self$deleteFile(out$id, x$id)}))

@eblondel eblondel self-assigned this Jan 17, 2022
@eblondel eblondel added the enhancement New feature or request label Jan 17, 2022
@eblondel
Copy link
Owner

Thanks @ThierryO i'll have a look asap.

@eblondel
Copy link
Owner

@ThierryO I see you set 0.6 as sleeping time, any reason for this value? did you test other values?

@ThierryO
Copy link
Author

1 min per 100 requests = 60 sec / 100 requests = 0.6 sec / request. So setting sleeping time to 0.6 makes sure that you never do more than 100 request per minute.

I've tried different values. 0.3 is too short, 0.4 worked for https://zenodo.org/record/5838468.

@ThierryO
Copy link
Author

I uses this code

zen_files <- zenodo$getFiles(myrec$id)
map_chr(zen_files, "id") %>%
  sort() %>%
  walk(
    function(fid) {
      message(fid)
      zenodo$deleteFile(recordId = myrec$id, fileId = fid)
      Sys.sleep(0.4)
    }
  )

eblondel added a commit that referenced this issue Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants