Listen out for concurrent instances

Issue #16 open
Dom Davis repo owner created an issue

As demonstrated on the stream it seems that the bot has multiple instances running when Fargate switches to a new version. The new version should wait until the old version is gone before it starts responding.

Comments (2)

  1. Dom Davis reporter

    So working on this there’s a whole bunch of things to consider, mostly related to transference of state and which instance is considered “primary”. The solution is a C&C channel which can perform handover. Given the amount of setting we’re gaining and the way that many other bots work it’s likely that much of the current state of the bot needs to be mutable and outside the configuration, so we’re going to want to move a bunch of stuff from config to state.

    Control flow will be:

    Bot starts up, announces self (passive state)
    On no response load state, assume control (active state)
    On response load state and check version, ack, assume control (active state)

    On receipt of announcement relinquish control (passive state)
    On ack shutdown listener
    If no ack/nack assert control (active state)

    On assert control announcement shutdown

    The behaviour here is to accommodate the behaviours of Fargate. If the new instance is being slow it will shut down before the LB starts feeding it data. It will then restart. The old instance will not be shut down.

  2. Log in to comment