Skip to content

Commit

Permalink
Use startup instead of lifespan
Browse files Browse the repository at this point in the history
  • Loading branch information
vladsavelyev committed Feb 16, 2024
1 parent 08de2a9 commit 332cfd4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,12 @@ def get_latest_release() -> models.LatestRelease:
logger.addHandler(logging.StreamHandler(sys.stdout))


@asynccontextmanager
async def lifespan(app: FastAPI):
@app.on_event("startup")
async def startup():
# Initialise the DB and tables on server startup
db.create_db_and_tables()
# Sync latest version tag using GitHub API
app.latest_release = get_latest_release()
yield


@app.on_event("startup")
Expand Down

0 comments on commit 332cfd4

Please sign in to comment.