=stop the timer
This commit is contained in:
parent
2d95efcaf8
commit
555e7b85ea
9 changed files with 23 additions and 17 deletions
|
@ -179,20 +179,25 @@ func (stream *PriorityStream) timer() {
|
|||
Mode: Stop.String(),
|
||||
}
|
||||
stream.Message <- msg
|
||||
log.Printf("stop timer %+v", stream.Duration)
|
||||
continue
|
||||
default:
|
||||
if len(stream.TotalClients) > 0 {
|
||||
currentTimer := fmt.Sprintf("%v", formatTime(stream.Duration))
|
||||
if stream.Duration >= 0 {
|
||||
currentTimer := fmt.Sprintf("%v", formatTime(stream.Duration))
|
||||
|
||||
msg := Message{
|
||||
Duration: currentTimer,
|
||||
Mode: Time.String(),
|
||||
msg := Message{
|
||||
Duration: currentTimer,
|
||||
Mode: Time.String(),
|
||||
}
|
||||
|
||||
// Send current time to clients message channel
|
||||
stream.Message <- msg
|
||||
time.Sleep(time.Second * 1)
|
||||
stream.Duration = stream.Duration - time.Second
|
||||
} else {
|
||||
timer.Stop()
|
||||
}
|
||||
|
||||
// Send current time to clients message channel
|
||||
stream.Message <- msg
|
||||
time.Sleep(time.Second * 1)
|
||||
stream.Duration = stream.Duration - time.Second
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue