Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

departures/arrivals: cache as atom if opt.duration missing #29

Open
derhuerst opened this issue Aug 17, 2022 · 0 comments
Open

departures/arrivals: cache as atom if opt.duration missing #29

derhuerst opened this issue Aug 17, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@derhuerst
Copy link
Member

Currently, we incorrectly try to cache a departures()/arrivals() call as a collection, even if it has no opt.duration. In this case, duration is NaN.

if (!('duration' in opt)) useCache = false
const duration = opt.duration * MINUTE

A sophisticated solution would be to "re-compute" duration once the departures/arrivals have been fetched from HAFAS. But I think a simpler solution would be sufficient: If opt.duration is missing, cache the results as an atom.

@derhuerst derhuerst added the bug Something isn't working label Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

1 participant