You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
426 B
22 lines
426 B
'use strict'
|
|
var validate = require('aproba')
|
|
var log = require('npmlog')
|
|
|
|
var pulsers = 0
|
|
var pulse
|
|
|
|
module.exports = function (prefix, cb) {
|
|
validate('SF', [prefix, cb])
|
|
if (!prefix) prefix = 'network'
|
|
if (!pulsers++) {
|
|
pulse = setInterval(function () {
|
|
log.gauge.pulse(prefix)
|
|
}, 250)
|
|
}
|
|
return function () {
|
|
if (!--pulsers) {
|
|
clearInterval(pulse)
|
|
}
|
|
cb.apply(null, arguments)
|
|
}
|
|
}
|