From 88f49986017764c400cead564d9a46f60f1922f8 Mon Sep 17 00:00:00 2001 From: Robin Olsen Date: Fri, 3 Apr 2026 12:59:17 +0200 Subject: [PATCH] this did not work --- cmd/pm/tasks/codingTask.go | 33 --------------------------------- cmd/pm/tasks/gitTask.go | 37 ------------------------------------- 2 files changed, 70 deletions(-) diff --git a/cmd/pm/tasks/codingTask.go b/cmd/pm/tasks/codingTask.go index afb2473..381b6d4 100644 --- a/cmd/pm/tasks/codingTask.go +++ b/cmd/pm/tasks/codingTask.go @@ -104,42 +104,9 @@ func (t *CodingTask) Setup(ctx context.Context) error { return err } - // Start file watcher goroutine - t.startFileWatcher(ctx) - return nil } -func (t *CodingTask) startFileWatcher(ctx context.Context) { - go func() { - ticker := time.NewTicker(2 * time.Second) - defer ticker.Stop() - - for { - select { - case <-ctx.Done(): - return - case <-ticker.C: - if t.app.SubmitChan == nil { - continue - } - - stat, err := os.Stat("./code.txt") - if err != nil { - continue - } - - if stat.ModTime().After(t.lastModified) { - t.lastModified = stat.ModTime() - select { - case t.app.SubmitChan <- models.ValidationTrigger{Source: models.ValidationTriggerAutoPoll}: - default: - } - } - } - } - }() -} func (t *CodingTask) Validate(ctx context.Context) ValidationFeedback { expect := check.NewExpector() diff --git a/cmd/pm/tasks/gitTask.go b/cmd/pm/tasks/gitTask.go index ec8cb02..92450f3 100644 --- a/cmd/pm/tasks/gitTask.go +++ b/cmd/pm/tasks/gitTask.go @@ -104,46 +104,9 @@ func (t *GitTask) Setup(ctx context.Context) error { return err } - // Initialize lastModified and start file watcher - if stat, err := os.Stat("./task/README.md"); err == nil { - t.lastModified = stat.ModTime() - } - t.startFileWatcher(ctx) - return nil } -func (t *GitTask) startFileWatcher(ctx context.Context) { - go func() { - ticker := time.NewTicker(2 * time.Second) - defer ticker.Stop() - - for { - select { - case <-ctx.Done(): - return - case <-ticker.C: - if t.app.SubmitChan == nil { - continue - } - - stat, err := os.Stat("./task/README.md") - if err != nil { - continue - } - - if stat.ModTime().After(t.lastModified) { - t.lastModified = stat.ModTime() - select { - case t.app.SubmitChan <- models.ValidationTrigger{Source: models.ValidationTriggerAutoPoll}: - default: - } - } - } - } - }() -} - func (t *GitTask) Validate(ctx context.Context) ValidationFeedback { expect := check.NewExpector()