feat: update timer management
- rename timerRunning to pomodoroRunning
- move function and timer definition to correct source file
🤖
This commit is contained in:
parent
90f80cc685
commit
c9501c3bbb
3 changed files with 10 additions and 10 deletions
|
@ -12,12 +12,13 @@ const (
|
|||
sessions = 4
|
||||
)
|
||||
|
||||
var pomodoroRunning bool
|
||||
var mu sync.Mutex // to synchronize access to shared state
|
||||
|
||||
// RunPomodoroTimer iterates the Pomodoro work/break sessions.
|
||||
func RunPomodoroTimer(clients map[*websocket.Conn]bool) {
|
||||
mu.Lock()
|
||||
timerRunning = true
|
||||
pomodoroRunning = true
|
||||
|
||||
for session := 1; session <= sessions; session++ {
|
||||
if !startTimer(clients, workDuration, "Work", session) {
|
||||
|
@ -34,6 +35,11 @@ func RunPomodoroTimer(clients map[*websocket.Conn]bool) {
|
|||
}
|
||||
}
|
||||
|
||||
timerRunning = false
|
||||
pomodoroRunning = false
|
||||
mu.Unlock()
|
||||
}
|
||||
|
||||
// IsPomodoroRunning returns the status of the timer.
|
||||
func IsPomodoroRunning() bool {
|
||||
return pomodoroRunning
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue