Skip to content

Commit

Permalink
don't pass nil clean up funcs to run.Group
Browse files Browse the repository at this point in the history
  • Loading branch information
sentriz committed Sep 25, 2023
1 parent 39fb8e7 commit c93852f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions cmd/gonic/gonic.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ func main() {
}))
}

noCleanup := func(_ error) {}

var g run.Group
g.Add(func() error {
log.Print("starting job 'http'\n")
Expand All @@ -266,7 +268,7 @@ func main() {
return server.ListenAndServeTLS(*confTLSCert, *confTLSKey)
}
return server.ListenAndServe()
}, nil)
}, noCleanup)

g.Add(func() error {
log.Printf("starting job 'session clean'\n")
Expand All @@ -275,7 +277,7 @@ func main() {
sessDB.Cleanup()
}
return nil
}, nil)
}, noCleanup)

g.Add(func() error {
log.Printf("starting job 'podcast refresher'\n")
Expand All @@ -286,7 +288,7 @@ func main() {
}
}
return nil
}, nil)
}, noCleanup)

g.Add(func() error {
log.Printf("starting job 'podcast purger'\n")
Expand All @@ -297,7 +299,7 @@ func main() {
}
}
return nil
}, nil)
}, noCleanup)

if *confScanIntervalMins > 0 {
g.Add(func() error {
Expand All @@ -309,7 +311,7 @@ func main() {
}
}
return nil
}, nil)
}, noCleanup)
}

if *confScanWatcher {
Expand Down Expand Up @@ -352,7 +354,7 @@ func main() {
g.Add(func() error {
log.Printf("starting job 'refresh artist info'\n")
return artistInfoCache.Refresh(lastfmAPIKey, 8*time.Second)
}, nil)
}, noCleanup)
}

if *confScanAtStart {
Expand Down

0 comments on commit c93852f

Please sign in to comment.