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

VehiclePositions generator loop randomly stops #2

Closed
ciolt opened this issue Jul 25, 2019 · 1 comment
Closed

VehiclePositions generator loop randomly stops #2

ciolt opened this issue Jul 25, 2019 · 1 comment

Comments

@ciolt
Copy link
Member

ciolt commented Jul 25, 2019

In production, after a lot of hours, it seems that the recursive function that handles VehiclePositions generation just stops. No apparent reason for it. This causes problems with Interchange.

I'm assuming Node.js is preventing infinite loops (which is technically what this is) and/or the setTimeout isn't firing sometimes.

The request listener for the VehiclePositions feed should trigger generation if the latest feed hasn't been updated in 15+ seconds.

@ciolt ciolt closed this as completed in 4d32b76 Jul 26, 2019
@ciolt
Copy link
Member Author

ciolt commented Jul 26, 2019

Update: it triggers a re-launch of the recursive generator function if it's been over 20 seconds since the last update.

In practice, it's updated every 10 seconds where the generator runs, waits 10 seconds, then fires again. A simple loop would cause collisions with some generation taking longer than others.

20 seconds is a reasonable-enough time to assume that the generator timed out while still short enough to not have a significant impact on realtime performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant