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

211
Vistas
Safe to remove async when no await's are used?

This may seam as a stupid question, but can I remove the async function below since there are no await's? It is a part of a large code base that is in production, so I am wondering if there could be some weird side effects if I remove async?

(async function(){
  'use strict';
  const {appLogger, monitorLogger} = require('./functions/logger');

...

  for (let i in p) {
    p[i].Filename = i;
    check(p[i]);
  }

...
    
  app.get('/example.json', (req, res) => {
    res.send(JSON.stringify(checkStates, null, 4));
  })

  app.listen(port, () => {
    appLogger.info(`Exposing http://localhost:${port}/example.json`);
  })

})();
about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

My only thought would be that the await wraps any returned value (that isn't a promise) in a promise. However, this is a self-calling function and from what you've shown us there is nothing returned and nothing expecting a return. So unless there's other code you haven't shown, yes you should be fine.

about 4 years ago · Juan Pablo Isaza Denunciar

0

Yes in this case you could remove async.

about 4 years ago · Juan Pablo Isaza Denunciar

0

nope you dont need async if you're not awaiting for any promises.

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