box / box-windows-sdk-v2

Windows SDK for v2 of the Box API. The SDK is built upon .NET Framework 4.5

Home Page:https://developer.box.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Download Zip - In Progress response

fftamc opened this issue · comments

commented

Description of the Issue

We are calling the DownloadZip method to download up to 150 documents at a time. When we call this method, we are sometimes receiving a BoxZipDownloadStatus response containing a BoxZipDownloadState of "In Progress". After working with BOX Support, we have concluded that the state of "In Progress" is still returning a filestream containing the zip files, however they warned that it may not contain all of the files.

If the response has a state of "In Progress" does this mean that we need to re-run the DownloadZip method to get the correct file stream containing all of the files?
Or is there a way that we can have the DownloadZip method wait until we either receive a state of "Succeeded" or "Failed" to know that download is completed?

Steps to Reproduce

We have a document list of 628 documents that we are attempting to download. We have tried downloading all 628 documents at a single time, and we have also tried breaking the download up into 5 separate calls, each containing no more than 150 documents.

While we do get the "In Progress" response back from the DownloadZip method, it is not consistent. Sometimes we will get "Succeeded" from all 5 of the DownloadZip calls. Other times we will get 1-5 "In Progress" responses.
We have been unable to consistently reproduce this issue.

Expected Behavior

Looking at the DownloadZip method, we would expect that the DownloadZip method would not return any response back until the full download has been completed or failed. The response of "In Progress" prevents us from being able to trust that the returned file stream contains all of the requested documents.

Error Message, Including Stack Trace

Screenshots

image

This image shows a returned response of "In Progress" when we attempted to download all 628 documents in one call.

Versions Used

.Net SDK: 4.3.1
Windows: 10

I see that the SDK does not check the status of the zip download request before trying to download it. It would be convenient if this check could be done by SDK and it would retry the download request when the status is in_progress. We always welcome PRs!

For now you could probably implement custom logic for downloading zips by constructing a manual api call or retry the zip downloads that failed by calling the DownloadZip method once again.

I have created a ticket to track this is issue internally (SDK-3141), but I can't give any timeframe at the moment when this change will be implemented.