global-electrification-platform / explorer

Global Electrification Platform (Web)
https://electrifynow.energydata.info/
MIT License
11 stars 7 forks source link

Explorer should gracefully handle timeouts #211

Closed EricSoroos closed 2 years ago

EricSoroos commented 4 years ago

The Explorer frontend should gracefully handle gateway timeouts or other errors on the backend: (from the chrome devtools console)

VM1958:1 GET https://gep-api.prod.derilinx.com/scenarios/et-1-1_0_0_0_0_0?year=2030 504 (GATEWAY_TIMEOUT)

error TypeError: Failed to fetch
bundle-ecabad4ed5.js:1 Uncaught (in promise) TypeError: Cannot read property 'featureTypes' of null
    at g (bundle-ecabad4ed5.js:1)
    at bundle-ecabad4ed5.js:1
    at X (vendor-542d206fe3.js:1)
    at Generator.P.u._invoke (vendor-542d206fe3.js:1)
    at Generator.e.<computed> [as throw] (vendor-542d206fe3.js:1)
    at t (bundle-ecabad4ed5.js:1)
    at bundle-ecabad4ed5.js:1

Later requests may succeed from the cache, but it requires a reload of the app, because it's hung due to the error, and that kills the context.

I'd suggest that on error, the frontend should retry the request. Eventually, it should work. However, to avoid killing the backend, it needs thundering herd protection. (https://github.com/global-electrification-platform/data-service/issues/76)