When I deployed a FastAPI app to heroku the startup event is fired twice. Is it my problem?
The code below is not my original app, but a temporary app I made for testing. And the Heroku was also made fresh for testing.
# Heroku logs
2022-10-18T08:37:32 app[api]: Build started by user junah.dev+1@gmail.com
2022-10-18T08:37:49 app[api]: Deploy 298098b0 by user junah.dev+1@gmail.com
2022-10-18T08:37:49 app[api]: Release v6 created by user junah.dev+1@gmail.com
2022-10-18T08:37:52 heroku[web.1]: State changed from down to starting
2022-10-18T08:37:54 heroku[web.1]: Starting process with command `uvicorn app.main:app --host=0.0.0.0 --port=${PORT:-5000}`
2022-10-18T08:37:55 app[api]: Build succeeded
2022-10-18T08:37:55.490285+00:00 app[web.1]: INFO: Uvicorn running on http://0.0.0.0:51121 (Press CTRL+C to quit)
2022-10-18T08:37:55 app[web.1]: INFO: Started parent process [4]
2022-10-18T08:37:55 app[web.1]: INFO: Started server process [11]
2022-10-18T08:37:55 app[web.1]: INFO: Waiting for application startup.
2022-10-18T08:37:55 app[web.1]: INFO: Application startup complete.
2022-10-18T08:37:55 app[web.1]: INFO: Started server process [10]
2022-10-18T08:37:55 app[web.1]: INFO: Waiting for application startup.
2022-10-18T08:37:55 app[web.1]: INFO: Application startup complete.
2022-10-18T08:37:56 heroku[web.1]: State changed from starting to up
# main.py
from fastapi import Depends, FastAPI
import uvicorn
app = FastAPI()
@app.get("/")
async def root():
return {"message": "Hello World"}
# Procfile
web: uvicorn app.main:app --host=0.0.0.0 --port=${PORT:-5000}