Select to view content in your preferred language

MapServer does not return latest features

457
2
01-31-2023 02:24 AM
ViktorSafar
Frequent Contributor

I have a Web Appbuilder widget using AGE FeatureServer and MapServer.

The FeatureServer is used to write new features to the database, which are then exposed via the MapServer. These are 2 separate services:

- AdminWrite/FeatureServer

- Public/MapServer

Each of them contain 4 layers. My widget talks to those layers.

 

When I add a feature via the FeatureServer, sometimes* it is not immediately available on the MapServer.

*- sometimes means for some users on some zoom levels.

See the GIF below.

ViktorSafar_0-1675160546280.gif

The feature that's disappearing and reappearing is from a MapServer (there are other features around it from the same service). It was added via the FeatureServer a few minutes ago. Onclick, we call queryFeatures so that's why it shows (queryFeatures/selectFeatures always uses latest data). To force the freshly-added features to show after they were added, I call .refresh() on the layer that points to the MapServer. As you can see, works sometimes.
 
The MapServer has no special caching treatment. It was published a few months ago. We reviewed the config yesterday.
 
HTTP responses from the MapServer (during zoom events) carry Cache-Control: public, must-revalidate, max-age=0
 
Anything else I should check?
How do I fix this?
0 Kudos
2 Replies
ViktorSafar
Frequent Contributor
Here I have created an example. The query contains an envelope which currently encompasses 2 features. To recreate my problem:
  1. I called the query in Chrome, got 1 feature (expected)
  2. I added another feature (geometry within the geometry of the old feature to ensure it will show up in the same query)
  3. I call the query in Chrome again, MapServer returns 304 Not Modified, giving me the 1 feature (I expected 2 features)
  4. I call the same query in PowerShell, sure enough I can see 2 features.

ViktorSafar_0-1675172681882.png

I can repeat step 3 over and over with the same result
0 Kudos
ViktorSafar
Frequent Contributor

I believe I narrowed it down to the browser request having an If-None-Match header with "0" as its value. From what I read that value should be unique and this does not appear to be a very unique value. How is this set by the JS SDK?

0 Kudos