Initial heartbeats not sent by Leader
When a Leader instance is created, it immediately sends out heartbeats
to the followers. However recent changes broke this behavior as
sendAppendEntries now checks if the follower's timeSinceLastActivity >=
heartbeat interval. However, in this case, timeSinceLastActivity is 0 so
the initial heartbeats aren't sent out. Also, on replication, it seems
that sendAppendEntries should always send AppendEntries. So we want to
disable this checking in these 2 cases. We only want check
timeSinceLastActivity if it's initiated by a scheduled heartbeat.
To resolve this, I changed the Leader constructor to directly call
sendAppendEntries instead of scheduling SendHeartbeat with delay 0. I
now pass in the interval to sendAppendEntries. The scheduled heartbeat
passes in the actual heartbeat interval and the oher 2 calls pass in 0.
Several unit tests in LeaderTest had to be changed due to the new
behavior.
Change-Id: I138db649b49ca18070a3247312521daf0dabc88e
Signed-off-by: tpantelis <tpanteli@brocade.com>