Keep alives are currently appended to the end of the buffer of data to send to the handover.
In the situation where we have a agency that has been absent for some time and therefore is having records queued up for it on the mediator, this leads to some keep alive failures.
If the keep alive response timeout is too low, then the keep alive may not even be sent to the agency before the timer expires, causing the handover to be dropped while clearing the backlog. The handover will likely reconnect and carry on, but it's not ideal and will likely cause concern for both users and agencies to see these connections continuing to drop.
Instead, we should avoid queuing a keep alive as long as there is data in the buffer to send via that handover, since keep alives should only be sent when the outgoing data connection is idle (as opposed to there being no incoming data for that handover coming from the collectors). We can instead restart the keep alive timer once the buffer is empty again.
Keep alives are currently appended to the end of the buffer of data to send to the handover.
In the situation where we have a agency that has been absent for some time and therefore is having records queued up for it on the mediator, this leads to some keep alive failures.
If the keep alive response timeout is too low, then the keep alive may not even be sent to the agency before the timer expires, causing the handover to be dropped while clearing the backlog. The handover will likely reconnect and carry on, but it's not ideal and will likely cause concern for both users and agencies to see these connections continuing to drop.
Instead, we should avoid queuing a keep alive as long as there is data in the buffer to send via that handover, since keep alives should only be sent when the outgoing data connection is idle (as opposed to there being no incoming data for that handover coming from the collectors). We can instead restart the keep alive timer once the buffer is empty again.