From: Ed Bartosh <ed.bartosh@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Cc: CABcZANkw_e36yhZgTVcMdVO5fm7=B4UoN-ZxjKOzNOQTvf3-1g@mail.gmail.com
Subject: Re: [PATCH v2] uievent: refactor retry loop
Date: Mon, 4 Jan 2016 10:20:30 +0200 [thread overview]
Message-ID: <20160104082030.GA14212@linux.intel.com> (raw)
In-Reply-To: <1451895136-13944-1-git-send-email-ed.bartosh@linux.intel.com>
wrong list. please ignore.
On Mon, Jan 04, 2016 at 10:12:16AM +0200, Ed Bartosh wrote:
> Replaced 'while' loop with 'for' loop.
> Made the code more compact and hopefully more understandable.
>
> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
> ---
> bitbake/lib/bb/ui/uievent.py | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/bitbake/lib/bb/ui/uievent.py b/bitbake/lib/bb/ui/uievent.py
> index 19a9301..af239a3 100644
> --- a/bitbake/lib/bb/ui/uievent.py
> +++ b/bitbake/lib/bb/ui/uievent.py
> @@ -45,27 +45,25 @@ class BBUIEventQueue:
> server.socket.settimeout(1)
>
> self.EventHandle = None
> - count_tries = 0
>
> # the event handler registration may fail here due to cooker being in invalid state
> # this is a transient situation, and we should retry a couple of times before
> # giving up
>
> - while self.EventHandle == None and count_tries < 5:
> + for count_tries in range(5):
> +
> self.EventHandle, error = self.BBServer.registerEventHandler(self.host, self.port)
>
> - if (self.EventHandle != None):
> + if self.EventHandle != None:
> break
>
> errmsg = "Could not register UI event handler. Error: %s, host %s, "
> "port %d" % (error, self.host, self.port))
> bb.warn("%s, retry" % errmsg)
> - count_tries += 1
> +
> import time
> time.sleep(1)
> -
> -
> - if self.EventHandle == None:
> + else:
> raise Exception(errmsg)
>
> self.server = server
> --
> 2.1.4
>
--
--
Regards,
Ed
prev parent reply other threads:[~2016-01-04 10:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-04 8:12 [PATCH v2] uievent: refactor retry loop Ed Bartosh
2016-01-04 8:20 ` Ed Bartosh [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160104082030.GA14212@linux.intel.com \
--to=ed.bartosh@linux.intel.com \
--cc=CABcZANkw_e36yhZgTVcMdVO5fm7=B4UoN-ZxjKOzNOQTvf3-1g@mail.gmail.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox