From d9e1bf1ff5f71d8c0802e3c77f754a9a04ee7ef5 Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Fri, 16 Jan 2015 08:36:15 +0000
Subject: [PATCH] reduce stutter with NewMasterElection

---
 masterelection/masterelection.go      | 9 ++++-----
 masterelection/masterelection_test.go | 2 +-
 node/node.go                          | 4 ++--
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/masterelection/masterelection.go b/masterelection/masterelection.go
index b8da1825..3b707e0d 100644
--- a/masterelection/masterelection.go
+++ b/masterelection/masterelection.go
@@ -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
 	}
diff --git a/masterelection/masterelection_test.go b/masterelection/masterelection_test.go
index 21c5b4f7..e342f7e4 100644
--- a/masterelection/masterelection_test.go
+++ b/masterelection/masterelection_test.go
@@ -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),
diff --git a/node/node.go b/node/node.go
index dc562285..72295be7 100644
--- a/node/node.go
+++ b/node/node.go
@@ -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,
-- 
GitLab