services/inter_comm/base.js
async function () {
    const oThis = this
    ;

    try {
      const highestBlock = await this.getChainHighestBlock();

      // return if nothing more to do.
      if (highestBlock - 6 <= oThis.lastProcessedBlock) return oThis.schedule();

      // consider case in which last block was not processed completely

      oThis.fromBlock = oThis.snmData.lastProcessedBlock + 1;
      oThis.toBlock = highestBlock - 6;

      const events = await oThis.completeContract.getPastEvents(
        oThis.EVENT_NAME,
        {fromBlock: oThis.fromBlock, toBlock: oThis.toBlock},
        function (error, logs) {
          if (error) logger.error('getPastEvents error:', error);
          logger.log('getPastEvents done from block:', oThis.fromBlock, 'to block:', oThis.toBlock);
        }
      );
      await oThis.processEventsArray(events);

      oThis.schedule();
    } catch (err) {
      logger.info('Exception got:', err);

      if (oThis.interruptSignalObtained) {
        logger.info('Exiting Process....');
        process.exit(1);
      } else {
        oThis.reInit();
      }

    }
  }
async function () {
    const oThis = this
    ;

    try {
      const highestBlock = await this.getChainHighestBlock();

      // return if nothing more to do.
      if (highestBlock - 6 <= oThis.lastProcessedBlock) return oThis.schedule();

      // consider case in which last block was not processed completely

      oThis.fromBlock = oThis.snmData.lastProcessedBlock + 1;
      oThis.toBlock = highestBlock - 6;

      const events = await oThis.completeContract.getPastEvents(
        oThis.EVENT_NAME,
        {fromBlock: oThis.fromBlock, toBlock: oThis.toBlock},
        function (error, logs) {
          if (error) logger.error('getPastEvents error:', error);
          logger.log('getPastEvents done from block:', oThis.fromBlock, 'to block:', oThis.toBlock);
        }
      );
      await oThis.processEventsArray(events);

      oThis.schedule();
    } catch (err) {
      logger.info('Exception got:', err);

      if (oThis.interruptSignalObtained) {
        logger.info('Exiting Process....');
        process.exit(1);
      } else {
        oThis.reInit();
      }

    }
  }
async function ( ) { const oThis = this ; try { const highestBlock = await this . getChainHighestBlock ( ) ; // return if nothing more to do. if ( highestBlock - 6 <= oThis . lastProcessedBlock ) return oThis . schedule ( ) ; // consider case in which last block was not processed completely oThis . fromBlock = oThis . snmData . lastProcessedBlock + 1 ; oThis . toBlock = highestBlock - 6 ; const events = await oThis . completeContract . getPastEvents ( oThis . EVENT_NAME , { fromBlock : oThis . fromBlock , toBlock : oThis . toBlock } , function ( error , logs ) { if ( error ) logger . error ( 'getPastEvents error:' , error ) ; logger . log ( 'getPastEvents done from block:' , oThis . fromBlock , 'to block:' , oThis . toBlock ) ; } ) ; await oThis . processEventsArray ( events ) ; oThis . schedule ( ) ; } catch ( err ) { logger . info ( 'Exception got:' , err ) ; if ( oThis . interruptSignalObtained ) { logger . info ( 'Exiting Process....' ) ; process . exit ( 1 ) ; } else { oThis . reInit ( ) ; } } }
Check for further events
Check for further events