Merge branch 'main' into Metrics-and-Logs

This commit is contained in:
Robin Olsen
2026-03-04 14:32:54 +01:00
9 changed files with 231 additions and 36 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"log/slog"
"time"
"github.com/LazyBachelor/LazyPM/internal/models"
tea "github.com/charmbracelet/bubbletea"
@@ -194,3 +195,30 @@ func runQuestionnaire(t Tasker, iType InterfaceType, collector *taskRunCollector
return nil
}
func startValidationLoop(ctx context.Context, t Tasker, feedbackChan chan ValidationFeedback, doneChan chan bool, quitChan chan bool) {
ticker := time.NewTicker(1 * time.Second)
defer ticker.Stop()
for {
select {
case <-ticker.C:
feedback := t.Validate(ctx)
if feedback.Success {
if feedback.Message == "" {
feedback.Message = "Task completed successfully! Going back to the survey menu..."
}
feedbackChan <- feedback
time.Sleep(4 * time.Second)
doneChan <- true
return
}
feedback.Message = "Task not completed!"
feedbackChan <- feedback
case <-quitChan:
return
case <-ctx.Done():
return
}
}
}