[ovs-dev] [PATCH 2/2] daemon: Throttle max respawning rate.

Ben Pfaff blp at nicira.com
Thu May 13 16:46:07 UTC 2010


On Wed, May 12, 2010 at 10:25:54AM -0700, Ben Pfaff wrote:
> On Tue, May 11, 2010 at 05:26:46PM -0700, Jesse Gross wrote:
> > On Tue, May 11, 2010 at 11:15 AM, Ben Pfaff <blp at nicira.com> wrote:
> > >
> > > +                /* Throttle restarts to no more than once every 10
> > > seconds. */
> > > +                if (time(NULL) < last_restart + 10) {
> > > +                    VLOG_WARN("%s, waiting until 10 seconds since last "
> > > +                              "restart", status_msg);
> > > +                    while (time(NULL) < last_restart + 10) {
> > > +                        sleep(1);
> > > +                    }
> > 
> > 
> > Why do we sleep in a loop here rather than computing the amount of time
> > once?
> 
> Mostly laziness.  I figured we needed a loop in case sleep() wakes up
> with EINTR.  But sleeping for the remaining time is probably a better
> approach.
> 
> Here's a revised patch.  Do you like it better?

I decided that it was probably fine, so I pushed out the revised series.
If you have comments then I'll gladly apply them in an additional
commit.




More information about the dev mailing list