HCA-Healthcare / elixir-mllp

An Elixir library for transporting HL7 messages via MLLP (Minimal Lower Layer Protocol)
Apache License 2.0
41 stars 19 forks source link

Telemetry wrongly assumes the connection is in a disconnected state #37

Open starbelly opened 2 years ago

starbelly commented 2 years ago

Currently a lot of places where a telemetry call is made assumes the state of the connection is disconnected.

Example : https://github.com/HCA-Healthcare/elixir-mllp/blob/cd0dc881e823bbcf2e6edfdbc3ce4d62f8a277ff/lib/mllp/sender.ex#L333

The fact is we simply don't know if that's true. We could have a better idea if we checked a lot of error codes, but without doing that, we can't assume we're disconnected.

It may be we might be in a better position as far as avoiding error code checking to deduce the status of the socket if we made use of {:active, :once} on in the client, even still there will be cases where we won't be sure unless we poll the socket (i.e., try to perform a read and see what we get).