Skip to content
This repository has been archived by the owner on Sep 4, 2021. It is now read-only.

Commit

Permalink
host: Separate out the jobStream cleanup logic.
Browse files Browse the repository at this point in the history
This makes it easier to comprehend, since we can now move it to where the
variable is actually being used.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
  • Loading branch information
Blaž Hrastnik authored and warpfork committed Jan 13, 2015
1 parent 18c49d4 commit 2600e5d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions host/host.go
Expand Up @@ -175,13 +175,7 @@ func runDaemon(args *docopt.Args) {
sh.Fatal(err)
}

var jobStream stream.Stream
sh.BeforeExit(func() {
if jobStream != nil {
jobStream.Close()
}
backend.Cleanup()
})
sh.BeforeExit(func() { backend.Cleanup() })

if force {
if err := backend.Cleanup(); err != nil {
Expand Down Expand Up @@ -281,6 +275,12 @@ func runDaemon(args *docopt.Args) {
h.Metadata[kv[0]] = kv[1]
}

var jobStream stream.Stream
sh.BeforeExit(func() {
if jobStream != nil {
jobStream.Close()
}
})
for {
newLeader := cluster.NewLeaderSignal()

Expand Down

0 comments on commit 2600e5d

Please sign in to comment.