fix bars
This commit is contained in:
parent
76aa1addb8
commit
22d0e023ee
|
@ -1,12 +1,13 @@
|
||||||
|
const normal = '▒';
|
||||||
const normal = '▒'
|
const crazy = '▇';
|
||||||
const crazy = '▇'
|
export default (valuefn = ary => ary.length, threshold = 100, yellowbox = false) => events => events.do(
|
||||||
export default (valuefn=(ary)=>ary.length, threshold=100, yellowbox=false)=>events=>events.do(
|
infoAry => {
|
||||||
(infoAry)=>{
|
const len = valuefn(infoAry);
|
||||||
const len = valuefn(infoAry)
|
|
||||||
if (yellowbox && len >= threshold) {
|
if (yellowbox && len >= threshold) {
|
||||||
console.warn(`bars: event rate over threshold (${threshold}): ${len}`)
|
console.warn(`bars: event rate over threshold (${threshold}): ${len}`);
|
||||||
}
|
}
|
||||||
console.log("tick", (len >= threshold ? crazy : normal).repeat(Math.floor(Math.log(Math.max(len,1)))) + `(${len})`)
|
console.log('tick', (len >= threshold ?
|
||||||
|
crazy
|
||||||
|
: normal).repeat(Math.floor(Math.log(Math.max(len, 1)))) + `(${len})`);
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
|
|
|
@ -4,13 +4,11 @@ import 'rxjs/add/operator/filter';
|
||||||
import 'rxjs/add/operator/do';
|
import 'rxjs/add/operator/do';
|
||||||
import 'rxjs/add/operator/bufferTime';
|
import 'rxjs/add/operator/bufferTime';
|
||||||
|
|
||||||
import { spy as log } from '../log'
|
|
||||||
|
|
||||||
class Stream {
|
class Stream {
|
||||||
constructor (emitter) {
|
constructor (emitter) {
|
||||||
this.events = Observable.fromEvent(emitter, 'mqspy')
|
this.events = Observable.fromEvent(emitter, 'mqspy');
|
||||||
this.spy = (info) => emitter.emit('mqspy', info)
|
this.spy = info => emitter.emit('mqspy', info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Stream
|
export default Stream;
|
||||||
|
|
Loading…
Reference in New Issue