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

146
Views
How to make event-triggered Cloud Function to "pause" while running?

I have my Nodejs Cloud Function executing some quick tasks upon invocation. I need to delay its termination by 20 seconds. What is the way to do this in the code?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Assuming you absolutely need this and you will not use this in production, this should be pretty straightforward if this is an asynchronous function.

Just define an async function that will return after an arbitrary amount of time:

async function sleepMS(timeMS) {
    await new Promise(res => setTimeout(res, timeMS))
}

then after all your code runs and before your function returns, call it with the amount of time you wish

await sleepMS(20 * 1000)
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!