Skip to content

Commit ff09f68

Browse files
committed
merge reparent
2 parents 490ab07 + 9c9941e commit ff09f68

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

state/presence/presence.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ func StartPinger(conn *zk.Conn, path string, period time.Duration) (*Pinger, err
7070
}
7171

7272
// Start begins periodically refreshing the context of the Pinger's path.
73-
// Consecutive calls to Start will panic, and will attempts to Start a
74-
// Pinger that has been Killed.
73+
// Start panics if called consecutively or after Kill.
7574
func (p *Pinger) Start() error {
7675
if p.tomb != nil {
7776
panic("pinger is already started")
@@ -125,14 +124,14 @@ func (p *Pinger) Kill() error {
125124

126125
// loop calls change on p.target every p.period nanoseconds until p is stopped.
127126
func (p *Pinger) loop() {
128-
defer p.tomb.Done()
129127
defer func() {
130128
// If we haven't encountered an error, always send a final write, to
131129
// ensure watchers detect the pinger's death as late as possible.
132130
if p.tomb.Err() == nil {
133131
_, err := p.target.change()
134132
p.tomb.Kill(err)
135133
}
134+
p.tomb.Done()
136135
}()
137136
for {
138137
select {

trivial/trivial.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func AtomicWrite(path string, obj interface{}) error {
2727
func EnsureDir(path string) error {
2828
fi, err := os.Stat(path)
2929
if os.IsNotExist(err) {
30-
return os.Mkdir(path, 0755)
30+
return os.MkdirAll(path, 0755)
3131
} else if !fi.IsDir() {
3232
return fmt.Errorf("%s must be a directory", path)
3333
}

0 commit comments

Comments
 (0)