[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAf2ycmc-GANpwaJgTc4tt29_rK0K6PLCz3g8FuffSauQOYMmA@mail.gmail.com>
Date: Wed, 13 Nov 2024 08:48:33 +0000
From: Donald Hunter <donald.hunter@...hat.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: Donald Hunter <donald.hunter@...il.com>, netdev@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>, Xiao Liang <shaw.leon@...il.com>,
Jiri Pirko <jiri@...nulli.us>
Subject: Re: [PATCH net-next v2 2/2] tools/net/ynl: add async notification handling
On Wed, 13 Nov 2024 at 01:38, Jakub Kicinski <kuba@...nel.org> wrote:
>
> some comments for your consideration, if you prefer to keep as is:
>
> Acked-by: Jakub Kicinski <kuba@...nel.org>
>
> On Tue, 12 Nov 2024 11:17:27 +0000 Donald Hunter wrote:
> > + def poll_ntf(self, duration=None):
> > + endtime = time.time() + duration if duration is not None else None
>
> we can record starttime here, and avoid the complex logic..
Yes, of course. That's a lot clearer.
> > + selector = selectors.DefaultSelector()
> > + selector.register(self.sock, selectors.EVENT_READ)
> > +
> > + while True:
> > + try:
> > + yield self.async_msg_queue.get_nowait()
> > + except queue.Empty:
> > + if endtime is not None:
> > + interval = endtime - time.time()
>
> then here:
>
> if duration is not None:
> timeout = time.time() - starttime + duration
That'd be starttime + duration - time.time().
I'll respin with these changes, thanks!
Powered by blists - more mailing lists