Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

166
Views
El evento de drenaje de transferencia no se activa

Pruebas de contrapresión de Transform. De alguna manera, con este código simple, el drenaje no funciona. Simplemente colgó. Cualquier ayuda es apreciada.

El código está debajo, si ejecuta el código, notará que se colgó.

flujo const = require('flujo'); const pipelineAsync = require('util').promisify(stream.pipeline);

 class MyTransform extends stream.Transform { constructor() { super({ objectMode: true, writableHighWaterMark: 10, }); } _transform(chunk, enc, cb) { console.log(`transform`, chunk) const nextData = `T${chunk}`; if (this.push(nextData)) { return cb(); } console.log('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! back pressured') this.once('drain', () => { console.log('drained======================================> This never fires on time') cb(); }) /* //this is bad as we can't gurranty wait is long enough (or too long and cause performance) setTimeout(() => { console.log('delayed cb !!!!!!!!!!!!!!!!!!!!') cb(); }, 1000); */ } } function getConsumer() { return new stream.Writable({ objectMode: true, write(chunk, enc, cb) { console.log(`======> Finish chunk`, chunk); setTimeout(() => { cb(); }, 100); } }) } function getAry() { const res = []; for (let i = 0; i < 100; i++) res.push(i); return res; } async function test() { await pipelineAsync( stream.Readable.from(getAry()) , new MyTransform() , getConsumer()); console.log('all produced'); } test();
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!