entur / lamassu

Mobility hub
European Union Public License 1.2
5 stars 7 forks source link

Return 503 for not yet available feeds instead of 404 #431

Closed hbruch closed 2 months ago

hbruch commented 2 months ago

Is your feature request related to a problem? Please describe. We have a few feed providers whose upstream gbfs feeds are temporarilly unavailable and hence can't be subscribed to by lamassu. Currently for these unitialized feeds lamassu responds with a 404 Not Found reply.

Goal / high level use-case Lamassu users may retrieve the gbfs endpoint and try to request all configured feeds. For feeds which currently are not available, they receive a 404 error, blaming themselves for wrongly requesting feeds that lamassu announces to exist.

Describe the solution you'd like We suggest to respond with e.g. 503 SERVICE UNAVAILABLE for feeds which are not yet available (i.e. a feedprovider for system_id is registered).

Describe alternatives you've considered Another option would be to not publish them in the gbfs endpoint as long as they are not available, but this would not adddress the unavailable issue if the gbfs response was cached or the client relies on the existance of the feed.

testower commented 2 months ago

Sounds reasonable. This means that the gbfs resource handler needs to check cache misses against the discovery file to determine whether it's a real 404 or a 503.