Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8722785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:29:25+00:00 2026-06-13T07:29:25+00:00

Below is my code in bottle. I am using uWSGI with the gevent loop.

  • 0

Below is my code in bottle. I am using uWSGI with the gevent loop. From the time of the request, I need to return false if the entire request is taking longer than 90 milliseconds.
I dont get how to use gevent to timeout after 90ms. The blocking codes less less than 2 ms. Its the redis calls that are the issue. Under no load or little load…entire requests takes under 20ms. Under severe load, redis calls can take longer…I need to time out if longer. So, from the first redis call, timeout if taking longer than 90 ms the return. If less than 90ms, calculate the remainder. E.g. if call one takes 60 ms then I have 30 ms for call two. If call 2 is taking longer then 30 ms then timeout.

@post('/test')
def test():

    #START THE TIMER

    #SOME BLOCKING CODE

    #MAKE A REDIS CALL AND SERVICE OTHER REQUESTS
    jt = [gevent.spawn(redis_call)]
    gevent.joinall(jt)

    #SOME BLOCKING CODE

    #MAKE A REDIS CALL AND SERVICE OTHER REQUESTS
    jt = [gevent.spawn(redis_call)]
    gevent.joinall(jt)

    if total_time<.09:
        yield "passed"
     else:
        yield "failed"
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:29:25+00:00Added an answer on June 13, 2026 at 7:29 am
    # start redis_call in a background greenlet
    g = gevent.spawn(redis_call)
    
    # wait for up to 90 seconds for redis_call to complete
    g.join(90)
    
    # if g has finished, kill() is a no-op
    # if g is still running, kill() will interrupt it (by raising GreenletExit in it)
    # by default, kill() waits for greenlet to exit (which might never happen, 
    # if redis_call caught GreenletExit and ignored it). You can also do g.kill(block=False) to
    # avoid waiting for killing to complete 
    g.kill()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

below code is my databasehandler class i got it from a tutorial. Beside that
HI: Below code is from RequestFactoryEditorDriver: /** * Returns a new array containing the
below code sample does not return the original text after encrypt/decrypt operation and I
Below code is for donwnloading file from azure blob. I have problem with .docx,.xlsx
Below code checks for last item but I need to check for the second
Below code is the response from the server: xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:xsd=http://www.w3.org/2001/XMLSchema><soap:Body><SendCardDetailsResponse xmlns=http://tempuri.org/><SendCardDetailsResult><ROOT xmlns=><DocumentElement><res-auth><auth-data count='1' ><**attribute
below code return File '' is not readable or does not exist always: $filters
Partial Code: My below code pulls a query from my DB and then uses
The below code is in OnTimer event. If items from 2 list boxes are
The below code is not displaying the image which is downloaded from online and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.