nextgis / android_gisapp

:dart: GIS application for Android
http://nextgis.com/nextgis-mobile
GNU General Public License v3.0
129 stars 107 forks source link

Doubled requests during sync #516

Closed BishopGIS closed 8 years ago

BishopGIS commented 8 years ago

During sync, mobile app request from server API version for each layer. This is doubled a request count and data volume sent on network.

Server log for 3 layers:

[pid: 28654|app: 0|req: 19219/25312] 176.99.221.48 () {40 vars in 562 bytes} [Wed Sep 21 08:19:56 2016] GET /ngw/api/component/pyramid/pkg_version => generated 133 bytes in 3 msecs (HTTP/1.1 200) 2 headers in 87 bytes (2 switches on core 0)
[pid: 28654|app: 0|req: 19220/25313] 176.99.221.48 () {38 vars in 766 bytes} [Wed Sep 21 08:19:56 2016] GET /ngw/api/resource/64/feature/?mdate={"gt":"2016-03-21T00:00:00Z"}&bbox=14516073.000000,5204969.000000,15477032.000000,6184456.000000 => generated 254 bytes in 67 msecs (HTTP/1.1 401) 3 headers in 135 bytes (1 switches on core 0)
[pid: 28654|app: 0|req: 19221/25314] 176.99.221.48 () {40 vars in 562 bytes} [Wed Sep 21 08:19:56 2016] GET /ngw/api/component/pyramid/pkg_version => generated 133 bytes in 1 msecs (HTTP/1.1 200) 2 headers in 87 bytes (2 switches on core 0)
[pid: 28656|app: 0|req: 3681/25315] 176.99.221.48 () {38 vars in 622 bytes} [Wed Sep 21 08:19:56 2016] GET /ngw/api/vector_layer/57/diff/?ts_start=2016-09-21T01:13:07Z => generated 43 bytes in 121 msecs (HTTP/1.1 200) 2 headers in 71 bytes (1 switches on core 0)
[pid: 28654|app: 0|req: 19222/25316] 176.99.221.48 () {40 vars in 562 bytes} [Wed Sep 21 08:19:57 2016] GET /ngw/api/component/pyramid/pkg_version => generated 133 bytes in 1 msecs (HTTP/1.1 200) 2 headers in 87 bytes (1 switches on core 0)
[pid: 28654|app: 0|req: 19223/25317] 176.99.221.48 () {38 vars in 764 bytes} [Wed Sep 21 08:19:57 2016] GET /ngw/api/resource/16/feature/?date={"gt":"2016-03-21T00:00:00Z"}&bbox=14516073.000000,5204969.000000,15477032.000000,6184456.000000 => generated 254 bytes in 86 msecs (HTTP/1.1 401) 3 headers in 135 bytes (2 switches on core 0)

The version check should be processed once at the beginning of the sync or at some period (one dat, one week, etc.)

4eRTuk commented 8 years ago

User can have multiple different accounts, so I made Map Accounts::Versions in sync method.