You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
gagsbh
3 years agoHelpful | Level 5
Too Many Write Operations when Uploading Files
Hello Greg-DB I am getting too_many_write_operations/ at times while uploading a hierarchy of folders each containing a single file. I am using the UploadSessionStartAsync, UploadSessionAppendV...
- 3 years ago
gagsbh You should set close=true on the last call to on upload session where you need to upload data for that upload session. That might actually be on a UploadSessionStartAsync call (for small files), or a UploadSessionAppendV2Async call, or a UploadSessionFinishAsync call, if not using UploadSessionFinishBatchAsync. If you are using UploadSessionFinishBatchAsync, then you do need to set close=true on the last UploadSessionStartAsync or UploadSessionAppendV2Async for that upload session.
Every upload session is used to upload one file, and has one upload session ID. So, the cursor for any given upload session should have the upload session ID for that upload session, and an offset that indicates how much has been uploaded so far for that upload session.
And yes, UploadSessionFinishBatchAsync takes an IEnumerable<UploadSessionFinishArg>, which should contain one UploadSessionFinishArg per upload session (each of which needs to be closed) that you wish to finish.
gagsbh
Helpful | Level 5
Happy New Year to Здравко and Greg-DB !
Thank-you for the clarification.
I now understand that I need to use UploadSessionStartAsync with Close = true instead of UploadAsync.
I have another query related to the last fragment call to UploadSessionAppendV2Async
As I understand, I need to make the last call to UploadSessionAppendV2Async with Close = true parameter.
var cursor = new UploadSessionCursor(uploadSession.SessionId, offset);
await clientadmin.Files.UploadSessionAppendV2Async(cursor, true, memStream);
Do I using the same cursor as used above while initializing UploadSessionFinishArg ?
And do I then add UploadSessionFinishArg to List<UploadSessionFinishArg> as below?
UploadSessionFinishArg arg = new UploadSessionFinishArg(cursor, new CommitInfo(uploadSession.Item.PathDisplay));
args.Add(arg);
where args is if type declared globally
public List<UploadSessionFinishArg> args = new List<UploadSessionFinishArg>();
And, once all upload sessions have been added to args, I call the UploadSessionFinishBatchAsync
UploadSessionFinishBatchArg batchArg = new UploadSessionFinishBatchArg(args);
var result = await clientadmin.Files.UploadSessionFinishBatchAsync(batchArg);
if(result != null && result.AsAsyncJobId != null && result.AsAsyncJobId.Value != null)
{
return result.AsAsyncJobId.Value;
}
Finally, check if Job is complete and obtain and process FileMetadata Entries
UploadSessionFinishBatchJobStatus resultstatus = await clientadmin.Files.UploadSessionFinishBatchCheckAsync();
if (resultstatus.IsComplete)
{
foreach (var filemetadata in resultstatus.AsComplete.Value.Entries)
{
//Process FileMetatData
}
}
Since, I did not find a Dot Net SDK sample for the UploadSessionFinishBatchAsync API, I need your feedback on the above steps that I plan to implement for Batch Uploads using "UploadSessionFinishBatchAsync" API.
Thanks,
Gagan
Greg-DB
3 years agoDropbox Staff
gagsbh You should set close=true on the last call to on upload session where you need to upload data for that upload session. That might actually be on a UploadSessionStartAsync call (for small files), or a UploadSessionAppendV2Async call, or a UploadSessionFinishAsync call, if not using UploadSessionFinishBatchAsync. If you are using UploadSessionFinishBatchAsync, then you do need to set close=true on the last UploadSessionStartAsync or UploadSessionAppendV2Async for that upload session.
Every upload session is used to upload one file, and has one upload session ID. So, the cursor for any given upload session should have the upload session ID for that upload session, and an offset that indicates how much has been uploaded so far for that upload session.
And yes, UploadSessionFinishBatchAsync takes an IEnumerable<UploadSessionFinishArg>, which should contain one UploadSessionFinishArg per upload session (each of which needs to be closed) that you wish to finish.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,882 PostsLatest Activity: 7 hours agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!