bjustin-ibm commented on issue #104: Add Redis support for managing active state URL: https://github.com/apache/incubator-openwhisk-package-cloudant/pull/104#issuecomment-308224649 It concerns me a bit that the "active" state is stored in redis as two separate fields. Theoretically speaking, it is not impossible that two hosts could both be recorded as "active". Practically speaking, I'm not sure exactly how this would happen, but it is at least _possible_. Another way to handle this would be to store a dictionary called `worker0` with a single field named `active` whose value is the id for the worker0 instance that is supposed to be active. In this way, there is only one field to determine who should be active, and that field can only have one value, making ambiguity impossible. A swap through redis would involve setting the `worker0[active]` field to be the host ID that should be active, followed immediately by publishing a message to the "worker0" channel. The contents of the message are not important, but each host in worker0 will subscribe to that channel, and when they get a message, they will consult the `worker0[active]` value in redis to see if they should or should not be active. They will then change their own internal state if needed. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
With regards, Apache Git Services
