LocalData / localdata-tiles

A tileserver for LocalData
5 stars 2 forks source link

UTF Grid error when new data is added #88

Open hampelm opened 10 years ago

hampelm commented 10 years ago

There's a weird inconsistent tile caching bug. Steps to reproduce:

  1. Submit data
  2. Click "refresh results". The new tiles appear and are clickable (since they're not served from cache)
  3. Refresh the survey. Grids will give an error like this:

Uncaught ReferenceError: lu1 is not defined

typeof lu1.lu_18_70574_96949 === 'function' && lu1.lu_18_70574_96949({
  "grid": [
    "                                                    !!!!!!!!!!!#",
    "                                                    !!!!!!!!!!!!",
    "                                                     !!!!!!!!!!!",
    "                                                     !!!!!!!!!!!",
    "                                                      !!!!!!!!!!",

4: Delete tiles in S3.

5: Refresh survey. Grids load and are functional (again, not served from cache)

6: Refresh survey again. Grids load from cache and are functional.

(7: Add results, click refresh, error appears)

prashtx commented 10 years ago

We're ignoring the query string when we save to S3 and when we check the S3 cache.

If we keep storing the full JSONP, then we need to use the query string in the filename. The situation above will become a cache miss, though. We also want to serve gzip'd data when appropriate (#71), which would require saving two copies of the data to S3. Instead, we could save just the JSON data to S3 and then send to the client through the tile server, adding JSONP wrappers and gzip'ing as appropriate.

hampelm commented 10 years ago

It's not clear to me why the tiles work again in step 6. Timing? Something about how the callbacks are generated?

prashtx commented 10 years ago

The UTFGrid plugin doesn't reuse callback IDs in the same document. It sounds like we could end up alternating between lu1 and lu2 for each tile as we refresh the data, assuming the old one gets removed from the window. https://github.com/danzel/Leaflet.utfgrid/blob/master/src/leaflet.utfgrid.js#L57

hampelm commented 10 years ago

Should we disable grid caching for now?