Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

225
Vistas
Eventstore client for NodeJs(@eventstore/db-client) stops the execution when 'maxCount' for reading the events from stream is increased more than 20

The program run fines when I have the following configuration:

let events = eventstoreClient.readStream(
       streamName,
       {
         fromRevision: END,
         direction: BACKWARDS,
         maxCount: 20
       }
     );

However, the program stucks(i.e. could not read the streams/events further) when maxCount is set to 100 or 1000 or maxCount option is not supplied!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

readStream returns a readable stream which will buffer the events internally until they exceed the highWaterMark threshold. The data will sit in the internal queue until it is consumed, and the stream will temporarily stop reading events from the server until the data currently buffered has been consumed.

When you request 20 events they fit within internal buffer, so after 20 events the stream closes and NodeJS is happy to stop execution. However, if you request 100 or 1000 events, once the internal buffer is full, the stream won't be closed as there are still events to be read from the server, and it will wait for you to consume those events.

You need to pull the events from the buffer to allow the streaming read to finish. This can be done in a number of ways, for example:

Iterate through the steam:

for await (const { event } of events) {
  console.log(event);
}

or add an event listener:

events.on("data", (event) => {
  console.log(event);
});

You can read more about buffering here: https://nodejs.org/api/stream.html#buffering

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda