Browse Source

fix: remove constant polling logging in pinner

develop
Ezerous 3 years ago
parent
commit
04c0ad3229
  1. 8
      packages/concordia-pinner/src/app.js

8
packages/concordia-pinner/src/app.js

@ -8,7 +8,7 @@ import { getResolvedRendezvousMultiaddress } from './utils/ipfsUtils';
import { logger } from './utils/logger'; import { logger } from './utils/logger';
const POLLING_INTERVAL = 1000; const POLLING_INTERVAL = 1000;
logger.info('Initializing API service.'); logger.info(`Initializing API service (polling interval is ${POLLING_INTERVAL / 1000}s).`);
const responseBody = { const responseBody = {
ipfs: { ipfs: {
@ -23,13 +23,11 @@ const responseBody = {
getResolvedRendezvousMultiaddress().then((multiaddress) => { getResolvedRendezvousMultiaddress().then((multiaddress) => {
const { address, port } = multiaddress.nodeAddress(); const { address, port } = multiaddress.nodeAddress();
const rendezvousUrl = `http://${address}:${port}`; const rendezvousUrl = `http://${address}:${port}`;
logger.info(`Resolved rendezvous URL to: ${rendezvousUrl}`); logger.info(`Resolved rendezvous URL to ${rendezvousUrl}`);
responseBody.rendezvous.url = rendezvousUrl; responseBody.rendezvous.url = rendezvousUrl;
}); });
const getStats = async (orbit) => { const getStats = async (orbit) => {
logger.info('Gathering stats.');
try { try {
const ipfs = orbit._ipfs; const ipfs = orbit._ipfs;
const { id } = await ipfs.id(); const { id } = await ipfs.id();
@ -70,7 +68,7 @@ const startAPI = (orbit) => {
}); });
app.listen(pinnerApiPort, () => { app.listen(pinnerApiPort, () => {
logger.info(`Pinner API at http://localhost:${pinnerApiPort}!`); logger.info(`Pinner API at http://localhost:${pinnerApiPort}`);
}); });
setInterval(getStats, POLLING_INTERVAL, orbit); setInterval(getStats, POLLING_INTERVAL, orbit);

Loading…
Cancel
Save