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

194
Vistas
Will events be emitted / captured while awaiting for a promise?

I'm kinda new to nodejs and I'm familiarizing myself with the event loop, queue, etc.

I was wondering what happens while I'm awaiting for a promise to resolve, regarding events. Will events be emitted while awaiting? (I'm subscribed to a message broker, getting a message triggers an event). Will the callbacks that are called on event be queued in the event queue?

I know that the callback won't be executed until the promise resolves but will the events be triggered?

Thanks ^^

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

0

When events are registered, their emission is simply controlled by whatever makes them emitted. However, the callback registered to handle the event would go first into the event queue, and their queue position is not determined by what other promises are awaiting resolution, rather the position is determined by whatever promises have been resolved or rejected and whatever events have been emitted ahead of the presently emitted event, and they will all wait for the call stack to be cleared before they are invoked in turn. The event loop is the process of doing that, that is, it executes tasks from the event queue only when the call stack is empty i.e. there is no ongoing task.

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