diff --git a/e2e/test_provider_proxy.py b/e2e/test_provider_proxy.py index 2bd9d8aff..a66675f7c 100644 --- a/e2e/test_provider_proxy.py +++ b/e2e/test_provider_proxy.py @@ -79,8 +79,10 @@ class TestProviderProxy(SeleniumTestCase): # Wait until outpost healthcheck succeeds healthcheck_retries = 0 while healthcheck_retries < 50: - if outpost.deployment_health: - break + if len(outpost.state) > 0: + state = outpost.state[0] + if state.last_seen: + break healthcheck_retries += 1 sleep(0.5) @@ -152,10 +154,13 @@ class TestProviderProxyConnect(ChannelsLiveServerTestCase): # Wait until outpost healthcheck succeeds healthcheck_retries = 0 while healthcheck_retries < 50: - if outpost.deployment_health: - break + if len(outpost.state) > 0: + state = outpost.state[0] + if state.last_seen and state.version: + break healthcheck_retries += 1 sleep(0.5) - self.assertIsNotNone(outpost.deployment_health) - self.assertEqual(outpost.deployment_version.get("version"), __version__) + state = outpost.state + self.assertTrue(len(state), 1) + self.assertEqual(state[0].version, __version__) diff --git a/passbook/outposts/channels.py b/passbook/outposts/channels.py index 5ddaa7a8e..7a6978ec9 100644 --- a/passbook/outposts/channels.py +++ b/passbook/outposts/channels.py @@ -55,7 +55,7 @@ class OutpostConsumer(AuthJsonConsumer): self.outpost = outpost.first() OutpostState( uid=self.channel_name, last_seen=datetime.now(), _outpost=self.outpost - ).save(timeout=OUTPOST_HELLO_INTERVAL * 2) + ).save(timeout=OUTPOST_HELLO_INTERVAL * 1.5) LOGGER.debug("added channel to cache", channel_name=self.channel_name) # pylint: disable=unused-argument @@ -72,9 +72,9 @@ class OutpostConsumer(AuthJsonConsumer): ) if msg.instruction == WebsocketMessageInstruction.HELLO: state.version = msg.args.get("version", None) - state.save(timeout=OUTPOST_HELLO_INTERVAL * 2) elif msg.instruction == WebsocketMessageInstruction.ACK: return + state.save(timeout=OUTPOST_HELLO_INTERVAL * 1.5) response = WebsocketMessage(instruction=WebsocketMessageInstruction.ACK) self.send_json(asdict(response))