• Home
  • Jobs
  • Courses
  • Questions
  • Teachers
  • For business
  • ES/EN

0

60
Views
Limit Fastapi to process only 1 request at a time and after its completion process the next request

I'm trying to limit Fastapi to process 1 request at a time. And while that request is being executed, other requests gets response that the Server is busy.

2 months ago ·

Santiago Trujillo

1 answers
Answer question

0

I cannot understand your requirement but you can either

  1. Use a library such as https://github.com/long2ice/fastapi-limiter or https://github.com/laurentS/slowapi to handle limits
  2. Write a middleware that sets a flag in Redis or some other in-memory database, whenever a request comes, check if the flag is True. If True reject the request and if False set it to True and process the request. Set the Flag to False when the Response is sent by the server.
2 months ago · Santiago Trujillo Report
Answer question
Find remote jobs
Loading

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post job Plans Our process Sales
Legal
Terms and conditions Privacy policy
© 2022 PeakU Inc. All Rights Reserved.