Improve resync handling code, resolving issue56

- Force resync count to be an integer
- Tidy up a very confusing set of if tests (correct, but unreadable)
Matt and I were having the same conversation in HipChat, and independently removed that test. You are right - it cannot be False there.

From: Cory Benfield [mailto:notifications@github.com]
Sent: 08 December 2014 12:14
To: Metaswitch/calico
Cc: Peter White
Subject: Re: [calico] Improve resync handling code, resolving issue56 (#58)


In calico/felix/felix.py:

>              if resync_id == self.resync_id:

> -                resync_in_progress = True

> +                #*************************************************************#

> +                #* It was part of the most recent resync.  Increment how     *#

> +                #* many ENDPOINTCREATED requests we have received, and if    *#

> +                #* this is the last one expected, complete the resync.       *#

> +                #*************************************************************#

> +                self.resync_recd += 1

> +                log.debug("Received ENDPOINTCREATED for resync, %d out of %d" %

> +                          (self.resync_recd, self.resync_expected))

> +

> +                if (self.resync_expected and

> +                    self.resync_recd == self.resync_expected):

Why the check on self.resync_expected? Is there any situation where that could be falsy, and if there is, why wouldn't we want to enter this block anyway?

—
Reply to this email directly or view it on GitHub<https://github.com/Metaswitch/calico/pull/58/files#r21448863>.