function update(rc, qt) {
  const _timestamp = createTimeStamp();
  const key = 'queueStats.' + _timestamp;
  const mainKey = 'queueStats';
  let obj;

  // get main key that containes array of timestamp keys
  client.hgetallAsync(key).then((reply) => {
    if (reply) {
      obj = {
        jobCount: Number(reply.jobCount) + ONE,
        recordCount: Number(reply.recordCount) + rc,
        queueTimeArray: addToArray(reply.queueTimeArray, qt),
      };
      logInvalidHmsetValues(key, obj);
      client.hmset(key, obj);
    } else {
      obj = {
        jobCount: ONE,
        recordCount: rc,
        queueTimeArray: addToArray('', qt),
        timestamp: _timestamp,
      };
      logInvalidHmsetValues(key, obj);
      client.hmset(key, obj);

      client.hgetallAsync(mainKey).then((_reply) => {
        const hmsetObj = {
          keyArray: addToArray(_reply ? _reply.keyArray : '', key),
        };
        logInvalidHmsetValues(mainKey, hmsetObj);
        client.hmset(mainKey, hmsetObj);
      });
    }
  })
  .catch((err) => {
    throw new Error(err);
  });
}
/**
 * Update recordCount, jobCount and push queue time when
 * job is done.
 *
 * @param {integer} rc - record count for individual job
 * @param {integer} qt - queue time for individual job
 */
Update recordCount, jobCount and push queue time when
job is done.

@param {integer} rc - record count for individual job
@param {integer} qt - queue time for individual job
Update recordCount jobCount and push queue time when job is done . @param { integer } rc - record count for individual job @param { integer } qt - queue time for individual job
function update(rc, qt) {
  const _timestamp = createTimeStamp();
  const key = 'queueStats.' + _timestamp;
  const mainKey = 'queueStats';
  let obj;
  client.hgetallAsync(key).then((reply) => {
    if (reply) {
      obj = {
        jobCount: Number(reply.jobCount) + ONE,
        recordCount: Number(reply.recordCount) + rc,
        queueTimeArray: addToArray(reply.queueTimeArray, qt),
      };
      logInvalidHmsetValues(key, obj);
      client.hmset(key, obj);
    } else {
      obj = {
        jobCount: ONE,
        recordCount: rc,
        queueTimeArray: addToArray('', qt),
        timestamp: _timestamp,
      };
      logInvalidHmsetValues(key, obj);
      client.hmset(key, obj);
      client.hgetallAsync(mainKey).then((_reply) => {
        const hmsetObj = {
          keyArray: addToArray(_reply ? _reply.keyArray : '', key),
        };
        logInvalidHmsetValues(mainKey, hmsetObj);
        client.hmset(mainKey, hmsetObj);
      });
    }
  })
  .catch((err) => {
    throw new Error(err);
  });
}
function update ( rc , qt ) { const _timestamp = createTimeStamp ( ) ; const key = 'queueStats.' + _timestamp ; const mainKey = 'queueStats' ; let obj ; client . hgetallAsync ( key ) . then ( ( reply ) => { if ( reply ) { obj = { jobCount : Number ( reply . jobCount ) + ONE , recordCount : Number ( reply . recordCount ) + rc , queueTimeArray : addToArray ( reply . queueTimeArray , qt ) , } ; logInvalidHmsetValues ( key , obj ) ; client . hmset ( key , obj ) ; } else { obj = { jobCount : ONE , recordCount : rc , queueTimeArray : addToArray ( '' , qt ) , timestamp : _timestamp , } ; logInvalidHmsetValues ( key , obj ) ; client . hmset ( key , obj ) ; client . hgetallAsync ( mainKey ) . then ( ( _reply ) => { const hmsetObj = { keyArray : addToArray ( _reply ? _reply . keyArray : '' , key ) , } ; logInvalidHmsetValues ( mainKey , hmsetObj ) ; client . hmset ( mainKey , hmsetObj ) ; } ) ; } } ) . catch ( ( err ) => { throw new Error ( err ) ; } ) ; }
Update recordCount, jobCount and push queue time when
 job is done.
Update recordCount jobCount and push queue time when job is done .
// get main key that containes array of timestamp keys