feat: add sonarr support
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
Dawid Wysokiński 2022-07-18 06:56:19 +02:00
parent 159f1c1a6c
commit de33bcb362
Signed by: Kichiyaki
GPG Key ID: 1ECC5DE481BE5184
1 changed files with 7 additions and 5 deletions

12
main.go
View File

@ -35,11 +35,7 @@ func main() {
log.Fatalln("newServer:", err)
}
go func(srv *http.Server) {
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
log.Fatalln("srv.ListenAndServe:", err)
}
}(srv)
go startServer(srv)
log.Println("Server is listening on the port", defaultPort)
@ -121,6 +117,12 @@ func newSonarrService() (*service.Sonarr, error) {
), nil
}
func startServer(srv *http.Server) {
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
log.Fatalln("srv.ListenAndServe:", err)
}
}
func waitForSignal(ctx context.Context) {
ctx, stop := signal.NotifyContext(ctx, os.Interrupt, syscall.SIGTERM)
defer stop()