Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 21x 21x 21x 4x 4x 4x 2x 2x 2x 3x 1x 1x 1x 2x 4x 21x 21x 21x 21x 7x 7x 21x 21x 21x 1x 1x 21x 21x 21x | const Streamz = require('streamz'); const util = require('util'); function Timeout(ms) { if (!(this instanceof Streamz)) return new Timeout(ms); Streamz.call(this); this.interval = setInterval(() => { if (this.last && (new Date()) - this.last > ms) { this.emit('error','ETL_TIMEOUT'); clearInterval(this.interval); } },ms); } util.inherits(Timeout,Streamz); Timeout.prototype._fn = function(d) { this.last = new Date(); return d; }; Timeout.prototype._flush = function(cb) { clearInterval(this.interval); return Streamz.prototype._flush.call(this,cb); }; module.exports = Timeout; |