From: robk-tahoe Date: Thu, 10 Apr 2008 21:27:35 +0000 (-0700) Subject: key_generator: fix edge case found on windows X-Git-Url: https://git.rkrishnan.org/simplejson/encoder.py.html?a=commitdiff_plain;h=8620c7271d6a51442f9cf71ab73aae2515d0a5ae;p=tahoe-lafs%2Ftahoe-lafs.git key_generator: fix edge case found on windows the windows (cygwin) buildslave has been failing the key generator test it turns out that the time check on whether to refill the pool, and the reactor, are interacting such that when the maybe_refill_pool call posted on the reactor fires, the test on whether to fill the pool fails. this adds a loop in the failure case to retry each 1s until it is time to refill the pool, thus mitigating this timing accuracy problem on windows. --- diff --git a/src/allmydata/key_generator.py b/src/allmydata/key_generator.py index 61fa9b2e..fd9b096f 100644 --- a/src/allmydata/key_generator.py +++ b/src/allmydata/key_generator.py @@ -55,6 +55,7 @@ class KeyGenerator(service.MultiService, foolscap.Referenceable): self.keypool.append(self.gen_key(self.DEFAULT_KEY_SIZE)) else: self.vlog('%s not refilling pool' % (self,)) + reactor.callLater(1, self.maybe_refill_pool) def gen_key(self, key_size): self.vlog('%s generating key size %s' % (self, key_size, ))