You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Stop delivering status updates when offline download is canceled #5538
Should the region (pack) go back to reporting its state as inactive? Is it safe for the developer to resume downloading the region at that point, before region would’ve stopped updating (with the current code)?
Android has enabled an API to achieve this via #5696. Setting OfflineRegion.setDeliverInactiveMessages(true/false) will let you enable/disable the delivery of messages once a region has been set inactive.
There are no plans to add a dedicated API to work around this issue on iOS and macOS. Instead, this ticket is tracking a fix in core that would stop sending these notifications when appropriate. We consider it essentially a bug in core that the state is still reported as active and notifications keep coming in.
In the meantime, if you absolutely need the cancelation to appear to take effect immediately, the workaround on iOS and macOS is to keep track of the packs you've canceled or keep track of the fact that this particular pack has been canceled, and ignore progress notifications based on that.
One consequence of this issue is that progress updates may be coming in after the developer has attempted to remove the offline pack. The errant progress updates would lead to bad memory access, as seen in #6092. The approach in #5696 wouldn’t address this race condition on iOS and macOS, because the MGLOfflinePack object has already been reclaimed by ARC by this point.
It's not possible to fix this at the core level. The status updates that to the main thread appear to come after the request to cancel a download were in fact sent by the asynchronous worker before it processed the request to cancel the download.
iOS and macOS should apply a fix similar to that applied on Android, where the main thread ignores notifications delivered after the request to cancel the download has been sent to the asynchronous worker.
In that case, I don’t think it makes sense to add a dedicated “deliverInactiveMessages” property, as #5696 did, to the iOS/macOS SDK. The SDK should just do the right thing, which apparently means dropping these notifications.
Activity
1ec5 commentedon Jul 1, 2016
Should the region (pack) go back to reporting its state as inactive? Is it safe for the developer to resume downloading the region at that point, before region would’ve stopped updating (with the current code)?
zugaldia commentedon Jul 1, 2016
/sub
dagatsoin commentedon Jul 9, 2016
Just to be sure is
the good way to cancel a download ?
zugaldia commentedon Jul 14, 2016
Android has enabled an API to achieve this via #5696. Setting
OfflineRegion.setDeliverInactiveMessages(true/false)will let you enable/disable the delivery of messages once a region has been set inactive.1ec5 commentedon Jul 14, 2016
We’re leaving this ticket open to track a fix in mbgl that would obviate the API added in #5696.
madsodgaard commentedon Jul 26, 2016
Any update on iOS ETA?
1ec5 commentedon Jul 26, 2016
There are no plans to add a dedicated API to work around this issue on iOS and macOS. Instead, this ticket is tracking a fix in core that would stop sending these notifications when appropriate. We consider it essentially a bug in core that the state is still reported as active and notifications keep coming in.
In the meantime, if you absolutely need the cancelation to appear to take effect immediately, the workaround on iOS and macOS is to keep track of the packs you've canceled or keep track of the fact that this particular pack has been canceled, and ignore progress notifications based on that.
/cc @jfirebaugh
1ec5 commentedon Aug 19, 2016
One consequence of this issue is that progress updates may be coming in after the developer has attempted to remove the offline pack. The errant progress updates would lead to bad memory access, as seen in #6092. The approach in #5696 wouldn’t address this race condition on iOS and macOS, because the MGLOfflinePack object has already been reclaimed by ARC by this point.
jfirebaugh commentedon Aug 27, 2016
It's not possible to fix this at the core level. The status updates that to the main thread appear to come after the request to cancel a download were in fact sent by the asynchronous worker before it processed the request to cancel the download.
iOS and macOS should apply a fix similar to that applied on Android, where the main thread ignores notifications delivered after the request to cancel the download has been sent to the asynchronous worker.
1ec5 commentedon Aug 27, 2016
In that case, I don’t think it makes sense to add a dedicated “deliverInactiveMessages” property, as #5696 did, to the iOS/macOS SDK. The SDK should just do the right thing, which apparently means dropping these notifications.
jfirebaugh commentedon Sep 12, 2016
#5508 is also related.