UNPKG

leap-node

Version:

[![codecov](https://codecov.io/gh/leapdao/leap-node/branch/master/graph/badge.svg)](https://codecov.io/gh/leapdao/leap-node) [![Docker Repository on Quay](https://quay.io/repository/leapdao/leap-node/status "Docker Repository on Quay")](https://quay.io/re

16 lines (13 loc) 459 B
const { logNode } = require('../utils/debug'); const pulse = require('./pulse'); async function loop(bridgeState, sender) { const { period, periodOnError } = bridgeState.config.heartbeat; try { await pulse(bridgeState, sender); setTimeout(() => loop(bridgeState, sender), period); } catch (e) { logNode('Failed to send heartbeat', e.toString()); setTimeout(() => loop(bridgeState, sender), periodOnError); } } module.exports = loop;