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

217
Views
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 answers
Answer question

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 Report

0

Yes in this case you could remove async.

about 4 years ago · Juan Pablo Isaza Report

0

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

about 4 years ago · Juan Pablo Isaza Report
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!