Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
autoradio
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ale
autoradio
Commits
d9e1bf1f
Commit
d9e1bf1f
authored
10 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
reduce stutter with NewMasterElection
parent
db380a83
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
masterelection/masterelection.go
+4
-5
4 additions, 5 deletions
masterelection/masterelection.go
masterelection/masterelection_test.go
+1
-1
1 addition, 1 deletion
masterelection/masterelection_test.go
node/node.go
+2
-2
2 additions, 2 deletions
node/node.go
with
7 additions
and
8 deletions
masterelection/masterelection.go
+
4
−
5
View file @
d9e1bf1f
...
...
@@ -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
}
...
...
This diff is collapsed.
Click to expand it.
masterelection/masterelection_test.go
+
1
−
1
View file @
d9e1bf1f
...
...
@@ -47,7 +47,7 @@ func TestMasterElection(t *testing.T) {
var
stop
[]
chan
bool
for
i
:=
0
;
i
<
n
;
i
++
{
stopCh
:=
make
(
chan
bool
)
m
:=
New
MasterElection
(
m
:=
New
(
etcd
,
lockPath
,
fmt
.
Sprintf
(
"%d"
,
i
),
...
...
This diff is collapsed.
Click to expand it.
node/node.go
+
2
−
2
View file @
d9e1bf1f
...
...
@@ -313,7 +313,7 @@ func NewRadioNode(name string, ips []net.IP, netDev string, bwLimit float64, max
name
:
name
,
ips
:
ips
,
client
:
client
,
me
:
masterelection
.
New
MasterElection
(
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
.
New
MasterElection
(
me
:=
masterelection
.
New
(
t
.
client
,
autoradio
.
TranscoderMasterElectionBase
+
t
.
params
.
TargetMount
,
t
.
nodeName
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment