Problems cancelling DownloadPreplannedOfflineMapJob

914
3
06-27-2018 09:52 AM
MatthewPierce
New Contributor II

I am having problems when I try to cancel an Esri.ArcGISRuntime.Tasks.Offline.DownloadPreplannedOfflineMapJob by calling myJob.Cancel() on my download job instance:

The first is that although the job itself is cancelled, any individual downloads (i.e. tpk and gdb files) that were previously started continue to run until completion. There will be cases where this will involve large downloads (upwards of 20GB), so preventing them from unnecessarily filling up disk space is paramount. I have yet to find a way to stop these downloads outside of stopping the app itself.

The other issue, which only exacerbates the first, is that I am unable to get access to the file handles for these downloaded items in order to delete the downloads (an exception is thrown indicating they are being used by another process), unless and until I restart my app. This adds unwanted complexity: If I know that I no longer want the resources, I want to be able to remove them immediately.

Are there any current workarounds for these issues? Any plans to enhance this behavior in future releases? Thanks.

Tags (3)
0 Kudos
3 Replies
AnttiKajanus1
Occasional Contributor III

Hi Matthew,


Thanks for the feedback. We are aware that the downloads don't get cancelled when cancelling the job but the good news is that we are currently working to fix that issue. Unfortunately, it didn't get into the 100.3 release but it should be in the next one. The cancel method at the moment allows any download that is started to finish but shouldn't start any new ones (ie. go to the next steps in the job).

Which files do you see being locked? Are you trying to delete them while the download is going on? Did you also call cancel before trying the delete? Are you showing the area on the map while you are trying to delete it?

0 Kudos
MatthewPierce
New Contributor II

Hi Antti,

Thanks for the quick reply (kiitos!). And good to know that it's in the pipeline. Would "next release" refer to 100.3.1 or 100.4? Is there any chance you have a timeline on that at this point?

It looks like the issue with deleting the file is indeed that it is still downloading after the job has been cancelled. Once the download is complete they can be removed, so we should be able to work around that for now.

0 Kudos
AnttiKajanus1
Occasional Contributor III

We are just getting a new release out of the door and this fix should in the "next-one" so it might be either 100.3.1 or 100.4 depending what we are going to get out from the door. 

I assumed that the lock is there due the download operation and there isn't much you can do with it at the moment. Unfortunately so the best pra, for now,r now is to make sure that you delete all files / folder that you don't need on the next time when you open the app. Personally I would download the stuff to a separate (temp) location and when everything is good i would move it to the "final" location so I could easily just purge the temp download location without any worries removing stuff that shouldn't be needed. But that's just one strategy on handling your downloads / temporary (on-demand/preplanned) data / permanent data.

0 Kudos