🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Make ServerStart variable global
Deluancdae4347a63e
diff --git a/consts/consts.go b/consts/consts.goindex df6691b3f..fe0d5f714 100644--- a/consts/consts.go+++ b/consts/consts.go@@ -69,4 +69,6 @@ var (VariousArtists = "Various Artists"VariousArtistsID = fmt.Sprintf("%x", md5.Sum([]byte(strings.ToLower(VariousArtists))))UnknownArtist = "[Unknown Artist]"++ ServerStart = time.Now())diff --git a/server/events/sse.go b/server/events/sse.goindex 0e96b043b..38eaf266e 100644--- a/server/events/sse.go+++ b/server/events/sse.go@@ -10,6 +10,7 @@ import ("sync/atomic""time"+ "github.com/deluan/navidrome/consts""github.com/deluan/navidrome/log""github.com/deluan/navidrome/model/request""github.com/google/uuid"@@ -186,7 +187,7 @@ func (b *broker) listen() {log.Debug("Client added to event broker", "numClients", len(clients), "newClient", c.String())// Send a serverStart event to new client- c.channel <- b.preparePackage(&ServerStart{serverStart})+ c.channel <- b.preparePackage(&ServerStart{consts.ServerStart})case c := <-b.unsubscribing:// A client has detached and we want to@@ -200,7 +201,7 @@ func (b *broker) listen() {// Send event to all connected clientsfor c := range clients {log.Trace("Putting event on client's queue", "client", c.String(), "event", event)- // Use non-blocking send. If cannot send, terminate the client's connection+ // Use non-blocking send. If cannot send, ignore the messageselect {case c.channel <- event:default:@@ -214,9 +215,3 @@ func (b *broker) listen() {}}}--var serverStart time.Time--func init() {- serverStart = time.Now()-}