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

Errors reading or writing to serial port should just exit #8

Open
smcameron opened this issue May 1, 2019 · 0 comments
Open

Errors reading or writing to serial port should just exit #8

smcameron opened this issue May 1, 2019 · 0 comments

Comments

@smcameron
Copy link
Contributor

logger.Debug().Msgf("Error reading packet: %s", err)

If an error is encountered reading or writing to the serial port, the code currently makes no attempt at recovery and just tries again as fast as it can spamming the log. This approach is doomed, it will never recover this way. Recovery would involve closing the file, and periodically re-opening it and trying again, with some delay, and eventually giving up. Realistically, the reason for the error is that somebody unplugged it. It's never going to recover. So just exit if an error is encountered reading or writing to the serial port. This is miles better than spamming the logs with infinite noise.

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