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

366
Views
How to use Async/await in FastAPI?

I have a route to accept request from user and return data to the user. There are the step

  1. User send request to my app
  2. Read data from database
  3. Update my database
  4. Return data to user

I want step 3 and step 4 above happen at the same time so the user will not be waiting for the update operation. How can I make this?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The thing you might be looking is called background task and luckily, FastAPI has an awesome documentation about how to implement that. Here you have!

But be careful, your title may be implying something different from your real question. The async/await will keep you away from blocking your server, but with background tasks you can make your user wait less time for their response. Saying that, if you're going to send a response without knowing anything else, remember to send a 202 status code (Accepted).

over 4 years ago · Santiago Trujillo 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!