Skip to content
Snippets Groups Projects
Commit d9e1bf1f authored by ale's avatar ale
Browse files

reduce stutter with NewMasterElection

parent db380a83
No related branches found
No related tags found
No related merge requests found
......@@ -51,11 +51,10 @@ type MasterElection struct {
state State
}
// NewMasterElection creates a new MasterElection object that will
// establish a lock on 'path'. It will send state transitions to
// 'sch', if provided. If 'sch' is not nil, it will be closed when
// Run() terminates.
func NewMasterElection(client autoradio.EtcdClient, path, data string, ttl uint64, sch chan State) *MasterElection {
// New creates a new MasterElection object that will establish a lock
// on 'path'. It will send state transitions to 'sch', if provided. If
// 'sch' is not nil, it will be closed when Run() terminates.
func New(client autoradio.EtcdClient, path, data string, ttl uint64, sch chan State) *MasterElection {
if ttl < 1 {
ttl = 1
}
......
......@@ -47,7 +47,7 @@ func TestMasterElection(t *testing.T) {
var stop []chan bool
for i := 0; i < n; i++ {
stopCh := make(chan bool)
m := NewMasterElection(
m := New(
etcd,
lockPath,
fmt.Sprintf("%d", i),
......
......@@ -313,7 +313,7 @@ func NewRadioNode(name string, ips []net.IP, netDev string, bwLimit float64, max
name: name,
ips: ips,
client: client,
me: masterelection.NewMasterElection(
me: masterelection.New(
client,
autoradio.MasterElectionPath,
string(minfodata),
......@@ -565,7 +565,7 @@ func (t *transcoder) run() {
// within the scope of this function.
update := make(chan masterelection.State)
mestop := make(chan bool)
me := masterelection.NewMasterElection(
me := masterelection.New(
t.client,
autoradio.TranscoderMasterElectionBase+t.params.TargetMount,
t.nodeName,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment