diff --git a/backend/backend b/backend/backend index 74373f8..f7f4923 100755 Binary files a/backend/backend and b/backend/backend differ diff --git a/backend/priority.go b/backend/priority.go index 316d0db..81c48e3 100644 --- a/backend/priority.go +++ b/backend/priority.go @@ -13,6 +13,7 @@ import ( func (w *Webapp) StartTimer(c *gin.Context) { var msg Message var err error + var timer time.Duration err = c.ShouldBind(&msg) if err != nil { @@ -21,15 +22,16 @@ func (w *Webapp) StartTimer(c *gin.Context) { return } - w.Stream.Duration, err = time.ParseDuration(msg.Duration) + timer, err = time.ParseDuration(msg.Duration) if err != nil { log.Printf("req error: %+v", err) c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) return } + w.Stream.Duration = timer w.Stream.Start = true - log.Printf("start timer %s", w.Stream.Duration) + log.Printf("start timer %s - received %s", w.Stream.Duration, msg.Duration) c.JSON(http.StatusOK, w.Stream.Duration) } diff --git a/backend/sse.go b/backend/sse.go index 987cc2b..61dcb8a 100644 --- a/backend/sse.go +++ b/backend/sse.go @@ -167,9 +167,10 @@ func (stream *PriorityStream) SendPriority(pri []string) { } func (stream *PriorityStream) timer() { - if stream.Start { - timer := time.NewTimer(stream.Duration) - for { + for { + if stream.Start { + timer := time.NewTimer(stream.Duration) + select { case <-timer.C: stream.Start = false @@ -178,10 +179,10 @@ func (stream *PriorityStream) timer() { Mode: Stop.String(), } stream.Message <- msg - return + continue default: if len(stream.TotalClients) > 0 { - currentTimer := fmt.Sprintf("The Current Time Is %v", formatTime(stream.Duration)) + currentTimer := fmt.Sprintf("%v", formatTime(stream.Duration)) msg := Message{ Duration: currentTimer, diff --git a/backend/static/_app/version.json b/backend/static/_app/version.json index 21d9464..ee5aea4 100644 --- a/backend/static/_app/version.json +++ b/backend/static/_app/version.json @@ -1 +1 @@ -{"version":"1701787521369"} \ No newline at end of file +{"version":"1701788771196"} \ No newline at end of file diff --git a/backend/static/_app/version.json.br b/backend/static/_app/version.json.br index e2d1d2c..0d382b9 100644 Binary files a/backend/static/_app/version.json.br and b/backend/static/_app/version.json.br differ diff --git a/backend/static/_app/version.json.gz b/backend/static/_app/version.json.gz index a331d2e..4360261 100644 Binary files a/backend/static/_app/version.json.gz and b/backend/static/_app/version.json.gz differ diff --git a/backend/static/index.html b/backend/static/index.html index 58d4b87..98aaa88 100644 --- a/backend/static/index.html +++ b/backend/static/index.html @@ -5,17 +5,17 @@ - + - - + +