0
嗨我試圖上傳一個圖像到我的保管箱,它的工作正常上傳,但是當我選擇一個多重圖像並將其上傳到保管箱一些圖像沒有上傳和錯誤說上傳Dropbox中的多個圖像錯誤(too_many_write_operations)
"{"error_summary": "too_many_write_operations/..", "error": {"reason": {".tag": "too_many_write_operations"}}}"
這是使用cordovafiletransfer
$cordovaImagePicker.getPictures(optionsSelectImage)
.then(function(results) {
console.log(results)
for (var i = 0; i < results.length; i++) {
// console.log('Image URI: ' + results[i]);
var image = results[i];
var counter = 0;
// var filename = JSON.stringify(results[i].substr(results[i].lastIndexOf('/') + 1));
// console.log(filename)
var options = {
headers: {
'Content-Type': 'application/octet-stream',
'Authorization': 'Bearer ACCESS TOKEN',
"Dropbox-API-Arg": '{"path": "/photo.jpg", "mode": "add","autorename": true,"mute": false}'
}
}
$cordovaFileTransfer.upload('https://content.dropboxapi.com/2/files/upload', image, options)
.then(function(result) {
// Success!
counter++;
if (counter != results.length) {
$ionicLoading.show({
//Loading Content
template: '<ion-spinner icon="android"></ion-spinner><br><center>Uploading ' + counter + ' /' + results.length + ' to Dropbox</center>'
});
}
// if number of files uploaded in the dropbox == total number of queued files for uploading
else if (counter === results.length) {
$ionicLoading.hide();
}
console.log(result)
}, function(err) {
// Error
console.log(err)
}, function(progress) {
});
代碼的IM,我認爲for循環過快的過程這就是爲什麼Dropbox的API不能處理它?我怎麼能慢下來或延遲爲
https://www.dropbox.com/developers-v1/core/bestpractices _RATE限制 API限制了您的應用每個用戶可以撥打的電話數量。這些限制足夠高,以致任何API的合理使用都不應該接近它們。達到速率限制的應用程序將收到503錯誤,該錯誤使用Retry-After標題來準確指示何時可以再次開始發出請求。如果您的應用使用OAuth 2.0,則錯誤將是429。如果您繼續達到這些限制,請聯繫我們的開發人員支持團隊,我們將與您合作._ – mplungjan
請注意,'too_many_write_operations'特別是沒有明確的速率限制。從[Dropbox API v2文檔](https://www.dropbox.com/developers/developers/documentation/http/documentation#error-handling): > too_many_write_operations無效在用戶的Dropbox中發生太多的寫入操作。這也被稱爲「鎖爭用」。您可以在[數據入口指南](https://www.dropbox.com/developers/reference/data-ingress-guide)中找到更多信息。 – Greg