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

365
Vistas
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 Respuestas
Responde la pregunta

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 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