outposts: always save state, even without version
This commit is contained in:
parent
327bb09dd4
commit
5556e9f8e7
|
@ -79,8 +79,10 @@ class TestProviderProxy(SeleniumTestCase):
|
||||||
# Wait until outpost healthcheck succeeds
|
# Wait until outpost healthcheck succeeds
|
||||||
healthcheck_retries = 0
|
healthcheck_retries = 0
|
||||||
while healthcheck_retries < 50:
|
while healthcheck_retries < 50:
|
||||||
if outpost.deployment_health:
|
if len(outpost.state) > 0:
|
||||||
break
|
state = outpost.state[0]
|
||||||
|
if state.last_seen:
|
||||||
|
break
|
||||||
healthcheck_retries += 1
|
healthcheck_retries += 1
|
||||||
sleep(0.5)
|
sleep(0.5)
|
||||||
|
|
||||||
|
@ -152,10 +154,13 @@ class TestProviderProxyConnect(ChannelsLiveServerTestCase):
|
||||||
# Wait until outpost healthcheck succeeds
|
# Wait until outpost healthcheck succeeds
|
||||||
healthcheck_retries = 0
|
healthcheck_retries = 0
|
||||||
while healthcheck_retries < 50:
|
while healthcheck_retries < 50:
|
||||||
if outpost.deployment_health:
|
if len(outpost.state) > 0:
|
||||||
break
|
state = outpost.state[0]
|
||||||
|
if state.last_seen and state.version:
|
||||||
|
break
|
||||||
healthcheck_retries += 1
|
healthcheck_retries += 1
|
||||||
sleep(0.5)
|
sleep(0.5)
|
||||||
|
|
||||||
self.assertIsNotNone(outpost.deployment_health)
|
state = outpost.state
|
||||||
self.assertEqual(outpost.deployment_version.get("version"), __version__)
|
self.assertTrue(len(state), 1)
|
||||||
|
self.assertEqual(state[0].version, __version__)
|
||||||
|
|
|
@ -55,7 +55,7 @@ class OutpostConsumer(AuthJsonConsumer):
|
||||||
self.outpost = outpost.first()
|
self.outpost = outpost.first()
|
||||||
OutpostState(
|
OutpostState(
|
||||||
uid=self.channel_name, last_seen=datetime.now(), _outpost=self.outpost
|
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)
|
LOGGER.debug("added channel to cache", channel_name=self.channel_name)
|
||||||
|
|
||||||
# pylint: disable=unused-argument
|
# pylint: disable=unused-argument
|
||||||
|
@ -72,9 +72,9 @@ class OutpostConsumer(AuthJsonConsumer):
|
||||||
)
|
)
|
||||||
if msg.instruction == WebsocketMessageInstruction.HELLO:
|
if msg.instruction == WebsocketMessageInstruction.HELLO:
|
||||||
state.version = msg.args.get("version", None)
|
state.version = msg.args.get("version", None)
|
||||||
state.save(timeout=OUTPOST_HELLO_INTERVAL * 2)
|
|
||||||
elif msg.instruction == WebsocketMessageInstruction.ACK:
|
elif msg.instruction == WebsocketMessageInstruction.ACK:
|
||||||
return
|
return
|
||||||
|
state.save(timeout=OUTPOST_HELLO_INTERVAL * 1.5)
|
||||||
|
|
||||||
response = WebsocketMessage(instruction=WebsocketMessageInstruction.ACK)
|
response = WebsocketMessage(instruction=WebsocketMessageInstruction.ACK)
|
||||||
self.send_json(asdict(response))
|
self.send_json(asdict(response))
|
||||||
|
|
Reference in New Issue