void updateWaitingCommands(){
  int index=commitIndex;
  if (isLeader()) {
    CoreCmd ccmd=waitQueue.peek();
    while (ccmd != null && ccmd.index <= index) {
      latency.tail(ccmd.index);
      ccmd.update(Command.STATUS_OK,leaderId);
      waitQueue.poll();
      ccmd=waitQueue.peek();
    }
  }
  saveQueue.getLatest(savedRid);
  index=Math.min(commitIndex,savedRid.index);
  commitQueue.updateCommitIndex(index);
}

void updateWaitingCommands ( ) { int index = commitIndex ; if ( isLeader ( ) ) { CoreCmd ccmd = waitQueue . peek ( ) ; while ( ccmd != null && ccmd . index <= index ) { latency . tail ( ccmd . index ) ; ccmd . update ( Command . STATUS_OK , leaderId ) ; waitQueue . poll ( ) ; ccmd = waitQueue . peek ( ) ; } } saveQueue . getLatest ( savedRid ) ; index = Math . min ( commitIndex , savedRid . index ) ; commitQueue . updateCommitIndex ( index ) ; }
called as a result of incoming append entry reply messages . attempts to release as many waiting commands as possible .
