improve fault tolerance and OS compat beyond linux
This commit is contained in:
parent
8e4f353be1
commit
75bd36a332
3 changed files with 30 additions and 20 deletions
|
|
@ -7,6 +7,7 @@ import (
|
|||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
|
@ -50,7 +51,11 @@ type (
|
|||
}
|
||||
)
|
||||
|
||||
func New(ctx context.Context) *Service {
|
||||
func New(ctx context.Context) (*Service, error) {
|
||||
if runtime.GOOS != "linux" {
|
||||
return nil, fmt.Errorf("Platform %s is unsupported", runtime.GOOS)
|
||||
}
|
||||
|
||||
nextTrack := make(chan *trackMetadata)
|
||||
nextPlaying := make(chan bool)
|
||||
|
||||
|
|
@ -63,7 +68,7 @@ func New(ctx context.Context) *Service {
|
|||
playingBroadcast: broadcast.NewBroadcastChannel(ctx, nextPlaying),
|
||||
}
|
||||
|
||||
return srv
|
||||
return srv, nil
|
||||
}
|
||||
|
||||
func (srv *Service) BindRoutes(group *gin.RouterGroup) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue