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

230
Views
How can I fire an event when a user attribute updates?

I have a FastAPI endpoints for game state updates. Each user has some guess count and if that becomes 0, then there will be cool down timer for x seconds before guesses can be replenished.

So how should this be supported from the server end? Should server fire an event when a user guess count becomes 0, that it can sleep for cool down time until guesses are replenished. If yes, how can that be done? Is there something FastAPI provides on that?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Yes, you can do that, without code it's hard to provide a exact answer, but you can achieve that by Background Tasks

So it could look something like this:

from fastapi import BackgroundTasks

async def refresh_user_stats(user: User = Depends(get_current_user)):
    do something here


@app.update()
async def refresh_user(background_tasks: BackgroundTasks):
    background_tasks.add_task(refresh_user_stats())
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!