pln-planning-tools / Starmap

Roadmap Planning Tool
https://starmap.site
Other
20 stars 8 forks source link

feat: /roadmap caching improvements #385

Open SgtPooki opened 11 months ago

SgtPooki commented 11 months ago

We have previously resolved some caching issues (i.e. https://github.com/pln-planning-tools/Starmap/issues/380), but one remains for /roadmap paths.

The current functionality works as follows:

  1. User requests roadmap view
  2. /roadmap request is made
  3. ServiceWorker has cache and returns it, but request waits until backend responds ("slow loading")

We should speed up responses for this path and also update the fix implemented by https://github.com/pln-planning-tools/Starmap/pull/383 is modified so that updated content can be retrieved.

Currently, the fix in https://github.com/pln-planning-tools/Starmap/pull/383 does not update the cache for /pendingChild paths unless the root roadmap request is not cached. Some additional optimization and tweaks need to be made here.

Some ideas:

  1. SW cache should only ever return immediately (do not keep request open while contacting backend).
    • Updating the cache should happen outside of main req-response workflow. We could use a queue of some sort to track urls returned from SW cache that we need to poll to check for updates, that are sent separately from user request.