Heartbeat seems to be sent only once (instead of every x seconds)
BoD opened this issue · 2 comments
After upgrading from 0.1.8 to the latest version (0.2.5) we are noticing that the Heardbeats are not sent regularly anymore. Instead they seem to be sent only once after the connexion is established.
After looking quickly at the code it seems that the hearbeat scheduling is done in Socket
, line 370:
dispatchQueue.queue(heartbeatInterval, TimeUnit.MILLISECONDS) { sendHeartbeat() }
And looking at the implementation (dispatchQueue
is a ScheduledDispatchQueue
), I see that it's based on ScheduledThreadPoolExecutor.schedule
which is a one-shot API, not a periodic one.
Is this correct?
That's correct. The heartbeat
should be scheduled on the same executor using a .scheduleAtFixedRate()
and not the one time use .schedule()
method. This will require creating another method on the DispatchQueue
interface, queueAtFixedRate()
Thanks for reporting this, I'll get a fix out for it shortly
included in release 0.2.6
Github is currently having outages. once those are resolved, the build will kick off