-
Notifications
You must be signed in to change notification settings - Fork 11
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
added a break condition to _ctrl_read_forever
#88
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #88 +/- ##
==========================================
+ Coverage 96.90% 97.07% +0.17%
==========================================
Files 12 12
Lines 1194 1196 +2
==========================================
+ Hits 1157 1161 +4
+ Misses 37 35 -2 ☔ View full report in Codecov by Sentry. |
Tested against the real panda and PandABlocks/PandABlocks-ioc#108 |
Should have a unit test added? |
8bf39ce
to
eb15736
Compare
Agreed, that's it added |
eb15736
to
313d2ba
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am missing the context of these empty packets. What situation(s) cause them to be sent, and what should the behaviour in the rest of this system be when one is received? What about multiple (as this code seems to look for)?
A second question is what should the restart/retry behaviour be when the connection is terminated; when the ConnectionError
exception is raised, that'll propogate out and presumably terminate all communication. Is the user expected to manually restart the connection at that point?
Also it may be worth writing a test that sends _EMPTY_PACKET_RETRIES - 1
packets, then a valid packet, then a few more empty packets to confirm that the counter resets correctly.
Context:
@evalott100 I have never seen the connection come back when it gets in that state, did you add the retry code because of something you saw, or just in case? |
Nothing I noticed, it's just in case. Happy to take it out if you think it's unneccesary? |
PythonSoftIOC #157 is currently under review that should allow this behaviour.
The more I read around this the more I am believing that, as soon as we see an empty byte response, the connection is gone and is not coming back. I'm more used to using sockets directly, rather than asyncio's wrappers around them, but for a socket if you receive a "0" from a |
Yes please |
d76dc12
to
e19d68c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change looks good. How visible is the exception message when the disconnect occurs i.e. where does it get logged to?
I'll add another loggging.error |
e19d68c
to
bd25115
Compare
Breaks out after a constant number of empty bytestrings have been received in a row.