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

444
Vistas
Bad: FastApi response problems

i create api using fastapi framework and i have deployed on heroku, the main function of this api is i have to send (post method) element as query parameter every 10s and i create path to show all elements sent but i facing problem when i refresh page i didn't get all element sent for example if i send [1, 2, 3, 4, 5, 6, 7, 8, 9] sometimes i get [1, 3, 4, 5, 7, 9] and sometimes i get [2, 6, 8], but in local i have api run perfectly.

from fastapi import FastAPI

app = FastAPI()

hr = []


@app.get("/")
async def api_status():
    return {"message": "api running"}


@app.get("/hr")
async def show_hr_values():
    if hr:
        return hr
    return {"message": "hr empty"}


@app.post("/hr")
async def add_hr_value(hr_value: int):
    hr.append(hr_value)
    return {"message": f"hr = {hr_value} added"}
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Heroku will not run your application as just one process. Since you're keeping this data in memory, it will only be updated and kept in that process that receives your request.

Use a database or KV store to store your data instead, so that it's stored in a centralized location that all processes can talk to. Heroku supports managed postgres and redis that you can use for either of these use cases.

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