Greenstand / node-mapnik-1

Bindings to mapnik for node.js
http://mapnik.org/documentation/node-mapnik
BSD 3-Clause "New" or "Revised" License
0 stars 4 forks source link

Tile request will fail sometimes. #74

Open dadiorchen opened 3 years ago

dadiorchen commented 3 years ago

When I switch between / and /new/, the tile server will crash.

image

The log shows:

  JOIN (
    SELECT
      region_id,
      zoom_level,
      count(tree_region.id) AS total,
      centroid
    FROM active_tree_region tree_region

    WHERE
      zoom_level = 3

    GROUP BY
      region_id,
      zoom_level,
      centroid ) contained ON
    ST_CONTAINS(region.geom,
    contained.centroid)
  WHERE
    TRUE
  ORDER BY
    region.id,
    total DESC
  ) zoom_target
  ON cluster_1.id = zoom_target.region_id

handle geojson...
get query
get from db:52, took time:51
get error when query db: TypeError: Cannot read property 'replace' of undefined
    at /app/greenstand/config.js:191:47
    at /app/greenstand/PGPool.js:41:45
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
dadiorchen commented 3 years ago

I think we should set the isNewIcon in the Config class as a member property:

https://github.com/Greenstand/node-mapnik-1/blob/7aae57171b4309c1c6719d67a5629faa164ccc4f/greenstand/config.js#L112-L114

Because we just new a single config object in the app.js, so all the concurrent http requests share the same object of Config, so by setting the isNewIcon, there might be conflict in these requests.

How about add the isNewIcon as a parameter of these two functions: buildMapInstance and getXMLString ?

dadiorchen commented 3 years ago

@Khu19sep can you take a look at this?