Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Gracefully Stop PeriodCallback During Shutdown
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Jon Parise  
View profile   Translate to Translated (View Original)
 More options Aug 23 2012, 7:13 pm
From: Jon Parise <j...@indelible.org>
Date: Thu, 23 Aug 2012 16:13:54 -0700
Local: Thurs, Aug 23 2012 7:13 pm
Subject: Re: [tornado] Gracefully Stop PeriodCallback During Shutdown
I took a closer look at this code against Tornado 2.3, and it doesn't
behave quite the same way as when I originally wrote it a couple of
years back.  For example, the polling behavior doesn't appear to be
working as it once did.  I don't know if something changed in the
surrounding code or in Tornado itself, but I'm afraid I don't have the
time to dig into it at the moment.

If you learn anything useful, however, I'd appreciate hearing about it.

On Wed, Aug 22, 2012 at 2:44 PM, Calvin <calvinwyo...@gmail.com> wrote:
> Ahh this is awesome -- looks like what I was looking for.

> But I do one question about how it works.  On line 20 of your gist, you
> check that there's only a single element in the _handlers list before
> stopping the ioloop.  Reading through the ioloop code, I can see that
> PeriodicCallbacks push _Timeouts onto the _timeout queue, but I fail to see
> how that relates to the _handlers queue.  Why does checking the _handlers
> queue work here?

> Thanks again!

> On Wednesday, August 22, 2012 12:42:26 PM UTC-7, Jon Parise wrote:

>> On Wed, Aug 22, 2012 at 11:03 AM, Calvin <calvin...@gmail.com> wrote:
>> > Hi all,

>> > I have a PeriodicCallback that makes HTTP requests to an external API
>> > via
>> > SimpleAsyncHTTPClient.  Whenever a request is made, it's important to
>> > record
>> > the response in the datatabase; missing a response is bad.

>> > Whenever I shut down the Tornado server, I run the risk of doing so in
>> > the
>> > middle of a request, which would cause my application to miss recording
>> > a
>> > response.  Is there a way to gracefully shut down Tornado, but block if
>> > the
>> > PeriodicCallback is currently running?

>> I use a graceful shutdown process in my application.  It blocks for up
>> to 10 seconds while it waits for IO loop handlers to complete.

>> Here's the code: https://gist.github.com/3428652


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.