localElector needs improvements in locking
The following discussion from !1979 (merged) should be addressed:
-
@8bitlife started a discussion: As for me this lock could be taken for too long.
nodesfield used only for read operations after it is initialized, so maybe you can create a constructor that will be accepting slice of nodes to initialize the field and let's say the first one will be used as the primary. Then we can omit locking to accessnodesas there will be only read operations on it. -
Work with statuses needs to be protected with lock for nodeCandidate as it is used concurrently in background and for each GetPrimary() call of localElector. -
run checkNode()in parallel
Edited by Stan Hu