lib/synchronization/slave.js
function getLatencyAndWait() {
      var result = null;

      if (isDestroyed) {
        return Promise.resolve(result);
      }

      return getLatency(slave)
          .then(function (latency) { result = latency })  // store the retrieved latency
          .catch(function (err)    { console.log(err) })  // just log failed requests
          .then(function () { return util.wait(DELAY) })  // wait 1 sec
          .then(function () { return result});            // return the retrieved latency
    }
function getLatencyAndWait() {
      var result = null;

      if (isDestroyed) {
        return Promise.resolve(result);
      }

      return getLatency(slave)
          .then(function (latency) { result = latency })  // store the retrieved latency
          .catch(function (err)    { console.log(err) })  // just log failed requests
          .then(function () { return util.wait(DELAY) })  // wait 1 sec
          .then(function () { return result});            // return the retrieved latency
    }
function getLatencyAndWait ( ) { var result = null ; if ( isDestroyed ) { return Promise . resolve ( result ) ; } return getLatency ( slave ) . then ( function ( latency ) { result = latency } ) // store the retrieved latency . catch ( function ( err ) { console . log ( err ) } ) // just log failed requests . then ( function ( ) { return util . wait ( DELAY ) } ) // wait 1 sec . then ( function ( ) { return result } ) ; // return the retrieved latency }
retrieve latency, then wait 1 sec
retrieve latency then wait 1 sec