cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to know more about how you can find anything and protect everything? Check it out here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dropbox.Api.RateLimitException when using CopyV2Async

Dropbox.Api.RateLimitException when using CopyV2Async

JohnStrudwick
Explorer | Level 4

I am experiencing Rate limit errors when using CopyV2Async

I am uploading a folder with sub folders but there are only 24 files in 11 folders

Is there a way to avoid these exceptions as I am forced to use a retry loop after catching the exception.

It nearly always succeeds after the first exception.

The code is one line:

var result = await objDbx.Files.CopyV2Async(szFolderToCopyFrom, szThisBackupSubFolder, true, true, true);

szFolderToCopyFrom is the folder on the windows machine and szThisBackupSubFolder is a new target folder on Dropbox

(Which immediately replicates back to the windows machine - I know it's odd, but the code works on dot maui so is across devices and so needs to work on IOS also which does not replicate)

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff

@JohnStrudwick The Dropbox API does have a general rate limiting system that applies to all endpoints. Also note though that if there are multiple changes at the same time in the same account or shared folder, you can run in to "lock contention" (which uses the 'too_many_write_operations' tag). That's not explicit rate limiting, but rather a result of how Dropbox works on the back-end. This is a technical inability to make a modification in the account or shared folder at the time of the API call. This applies to all account types. This error indicates that there was simultaneous activity in the account or shared/team folder preventing your app from making the state-modifying call (e.g., adding, editing, moving, copying, sharing, or deleting files/folders) it is attempting. The simultaneous activity could be coming from your app itself, or elsewhere, e.g., from the user's desktop client. It can come from the same user, or another member of a shared folder. You can find more information about lock contention and optimizations you can make here.

In short, to avoid this error, you should avoid making multiple concurrent state modifications and use batch methods where possible, such as CopyBatchV2Async like Здравко mentioned. That won't guarantee that you won't run in to this error though, as contention can still come from other sources, so you should also implement error handling and automatic retrying as needed.

I recommend referring to the error documentation and Error Handling Guide for more information.

View solution in original post

2 Replies 2

Hi @JohnStrudwick,

It's always a good idea to optimize the code whenever possible, so exceptions like rate limit to be less likely (of course, you cannot exclude them completely and should be ready to handle such case always). In your case you have a bunch of things to copy. Why do you need to copy them piece by piece and not in batch? 🤔

Hope this gives direction. 😉

 

PS: By the way all paths are Dropbox paths!!! None of them is machine (Windows or any other) path.

Greg-DB
Dropbox Staff

@JohnStrudwick The Dropbox API does have a general rate limiting system that applies to all endpoints. Also note though that if there are multiple changes at the same time in the same account or shared folder, you can run in to "lock contention" (which uses the 'too_many_write_operations' tag). That's not explicit rate limiting, but rather a result of how Dropbox works on the back-end. This is a technical inability to make a modification in the account or shared folder at the time of the API call. This applies to all account types. This error indicates that there was simultaneous activity in the account or shared/team folder preventing your app from making the state-modifying call (e.g., adding, editing, moving, copying, sharing, or deleting files/folders) it is attempting. The simultaneous activity could be coming from your app itself, or elsewhere, e.g., from the user's desktop client. It can come from the same user, or another member of a shared folder. You can find more information about lock contention and optimizations you can make here.

In short, to avoid this error, you should avoid making multiple concurrent state modifications and use batch methods where possible, such as CopyBatchV2Async like Здравко mentioned. That won't guarantee that you won't run in to this error though, as contention can still come from other sources, so you should also implement error handling and automatic retrying as needed.

I recommend referring to the error documentation and Error Handling Guide for more information.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Здравко Legendary | Level 20
What do Dropbox user levels mean?