1
0
mirror of https://github.com/go-task/task.git synced 2025-11-25 22:32:55 +02:00

feat(watcher): migrate to fsnotify (#2048)

This commit is contained in:
Andrey Nering
2025-03-22 20:06:16 -03:00
committed by GitHub
parent 89caf1e049
commit 0d5f2b5dab
14 changed files with 245 additions and 173 deletions

View File

@@ -7,6 +7,7 @@ import (
"sync"
"time"
"github.com/puzpuzpuz/xsync/v3"
"github.com/sajari/fuzzy"
"github.com/go-task/task/v3/internal/logger"
@@ -65,6 +66,7 @@ type (
mkdirMutexMap map[string]*sync.Mutex
executionHashes map[string]context.Context
executionHashesMutex sync.Mutex
watchedDirs *xsync.MapOf[string, bool]
}
TempDir struct {
Remote string
@@ -77,7 +79,6 @@ type (
func NewExecutor(opts ...ExecutorOption) *Executor {
e := &Executor{
Timeout: time.Second * 10,
Interval: time.Second * 5,
Stdin: os.Stdin,
Stdout: os.Stdout,
Stderr: os.Stderr,
@@ -254,8 +255,8 @@ func ExecutorWithConcurrency(concurrency int) ExecutorOption {
}
}
// ExecutorWithInterval sets the interval at which the [Executor] will check for
// changes when watching tasks.
// ExecutorWithInterval sets the interval at which the [Executor] will wait for
// duplicated events before running a task.
func ExecutorWithInterval(interval time.Duration) ExecutorOption {
return func(e *Executor) {
e.Interval = interval