Open dpattou opened 2 years ago
Screenshots:
@dpattou Sorry for the late reply. SDK uses a shared pool of background processes to handle requests to tile data sources. My guess is that due to slow network connection, these processes get stuck and new requests are queued. You can give some layers a higher priority though (like your GeoJSONVectorTileLayer
), by using layer.setUpdatePriority(N)
where N
should be > 0.
Regarding the 2nd issue, I am not sure this issue can be really solved as once the online data source gets stuck, new requests will not be handled until the data source manages to handle the request or receives a timeout.
@mtehver but then why would it prevent the local vector data source from drawing? I understand that the background pool might be stuck but it should prevent a local data source from drawing. There is no "request" on the local vector data source
@farfromrefug All data source requests are submitted to pools. There are 2 pools: one for tile data sources and one for non-tile data sources. Thus GeoJSONVectorTileDataSource
instances share the same pool with HTTPTileDataSource
instances.
An important technical detail: if pools are busy (all available threads are already executing a task) but a new task comes in with a higher priority, pools will dynamically grow and the task will be executed without delay. This was implemented pre 4.4.0, I believe.
@mtehver thanks for explaining ! this clarifies it a lot
Thanks for the answer @mtehver. Sorry for the delay, I was away for quite a while.
Using layer.setUpdatePriority(N) seems to indeed solve the 1st issue and the GeoJSONLayer is correctly drawn while tiles are loading. Great, thanks !
Regarding the 2nd issue, is there a way to set a lower timeout duration ? This would improve the user experience a lot if it could be set to 10-20seconds. Currently, it can sometime hang for more than a minute, and iOS frequently logs the following message:
Background Task 10 (“<private>“), was created over 30 seconds ago. In applications running in the background, this creates a risk of termination. Remember to call UIApplication.endBackgroundTask(_:) for your task in a timely manner to avoid this.
Hi @mtehver,
Any ideas about the timeout duration ?
In poor mobile network condition it really makes the whole map unusable.
@jarmani By default we do not change platform-specific timeouts of network connections. In case of Android, SDK uses HttpURLConnection
which may not have a finite timeout at all. So indeed, in case of bad network conditions, map may become 'stuck'.
I will add setTimeout
methods to CartoOnlineTileDataSource
, HTTPTileDataSource
and MapTilerOnlineDataTileDataSource
in SDK 4.4.6.
@jarmani @dpattou setTimeout
for online tile data sources is now available in 4.4.6-rc.1.
Amazing, thanks !
Hello, I ran into what I think might be a SDK issue, although I'm not 100% sure. Please let me know if I'm just doing something incorrect / this is normal behavior :)
I'm using the mobile SDK 4.4.4, via the nativescript-carto plugin.
I'm displaying a track and some other elements on a GeoJSONLayer (styled using carto css), which sits on top of a RasterTileLayer loading tiles from map tiler via a HTTPTileDataSource. I'm also displaying the user location on a VectorLayer.
Everything seems to be working fine when the phone's network is good or completely turned off. However, if the network is really bad (or, to easily reproduce the issue, set to EDGE / Poor on the Android simulator), I'm running into an issue where the GeoJSONLayer stops updating while the HTTPTileDataSource is issuing requests to map tiler. Sometimes, it can take about a minute for a request to timeout or to complete, and during this whole minute, the GeoJSONLayer, and thus the track and other elements, are no longer drawn.
This happens on new / not yet downloaded tiles that the HTTPTileDataSource is trying to load, which is a big issue, but if moving the map around and playing with zoom a bit the whole track (or most of it) ends up disappearing from the screen...
When switching back (using the simulator) to a good network connection, new tiles are loaded and the GeoJSONLayer is re drawn normally.
All this time, the user marker displayed on the VectorLayer is correctly drawn and visible.
Below are a few logs which show the GeoJSONLayer updating and as soon as an call to map tiler is made by the HTTPTileDataSource, update logs (and actual updates ;) ) stop, and if looking at the log timestamps, we can clearly see that this can happen for more than a minute.
I may be be able to avoid this issue by drawing everything I'm drawing on the GeoJSONLayer on the VectorLayer instead but this would have some drawbacks so any help to resolve or work around this issue would be very much appreciated :)
Thank you !
Logs:
Note: The HTTPTileDataSource is wrapped in a PersistentCacheDataSource, but using the HTTPTileDataSource directly doesn't solve the issue.
2nd note: I'm also running into the issue in another 'mode' where I'm using an OrderedTileDataSource, with an offline (cache only) and online data source with different zoom levels. While the requests from the online data source are ongoing, 'gray' tiles are shown and no data from either the offline data source or GeoJSONLayer is drawn.