Commit 89ff7be
committed
Cache the file during contiguous upload for Dropbox
Dropbox's rate limiting feature may cause uploading/copying/moving
many files in parallel to fail with either "too_many_requests" or
"too_many_write_operations". The former is literally used for "too
many requests" while the latter for namespace lock contentions. See
https://www.dropbox.com/developers/reference/data-ingress-guide for
more details.
In addition, Dropbox doesn't reveal how they rate-limit requests and
is actively testing different algorithms. They recommend clients to
retry according to the "Retry-After" header in the 429 response.
However, the retry doesn't work in a straightforward way for upload
requests since the stream will have been consumed when the request is
finished. Please note both inter copy and move use upload internally.
The solution is to cache the stream locally into a temporary file and
stream from it for both the initial request and following 429 retries.1 parent 1e2841c commit 89ff7be
1 file changed
+51
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
281 | 282 | | |
282 | 283 | | |
283 | 284 | | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
284 | 301 | | |
285 | 302 | | |
286 | 303 | | |
287 | 304 | | |
288 | 305 | | |
289 | 306 | | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
307 | 341 | | |
308 | 342 | | |
309 | 343 | | |
| |||
0 commit comments