Skip to content
This repository has been archived by the owner on Oct 14, 2022. It is now read-only.

Commit

Permalink
Reduce logging noise during load
Browse files Browse the repository at this point in the history
  • Loading branch information
pfrazee committed May 18, 2018
1 parent 07461ae commit b6c3e89
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/archiver.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const lock = require('./lock')
const {du, datStat, datReadFile, isObject} = require('./helpers')
const debug = require('debug')('archiver')
const figures = require('figures')
const {summaryConsole} = require('pauls-log-utils')
const {summaryConsole, debounceConsole} = require('pauls-log-utils')

const stat = promisify(require('fs').stat)
const mkdirp = promisify(require('mkdirp'))
Expand Down Expand Up @@ -363,7 +363,7 @@ module.exports = class Archiver extends EventEmitter {
}

// join the swarm
console.log(figures.info, 'Swarming archive', datEncoding.toStr(archive.key))
debounceConsole.log(`${figures.info} Swarming archive`, {timeout: 250, max: 1e3}, datEncoding.toStr(archive.key))
archive.isSwarming = true
archive.swarmOpts = opts
this.swarm.listen(archive.discoveryKey, 0, () => {})
Expand Down
5 changes: 2 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const path = require('path')
const fs = require('fs')
const wrap = require('co-express')
const PEAnalytics = require('pauls-embedded-analytics')
const {debounceConsole} = require('pauls-log-utils')

const {hashPassword} = require('./crypto')
const figures = require('figures')
Expand Down Expand Up @@ -102,9 +103,7 @@ class Hypercloud {
var ps = []
this.archivesDB.archivesDB.createKeyStream().on('data', key => {
ps.push(this.archiver.loadArchive(key).then(null, _ => null))
if (ps.length % 10 === 0) {
console.log(figures.pointerSmall, 'Loading', ps.length, 'archives...')
}
debounceConsole.log(`${figures.pointerSmall} Loading archive`, {timeout: 500, max: 1e3})
}).on('end', async () => {
await Promise.all(ps)
console.log(figures.tick, 'All archives loaded,', ps.length, 'total')
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"nodemailer-stub-transport": "^1.1.0",
"pauls-dat-api": "^4.5.0",
"pauls-embedded-analytics": "^2.0.1",
"pauls-log-utils": "^1.0.0",
"pauls-log-utils": "^1.1.0",
"pmx": "^1.6.4",
"pretty-bytes": "^4.0.2",
"pump": "^1.0.3",
Expand Down

0 comments on commit b6c3e89

Please sign in to comment.