增加 command -> delayMillSecond 参数
This commit is contained in:
@@ -129,7 +129,7 @@ func initWatcher() {
|
|||||||
defer watcher.Close()
|
defer watcher.Close()
|
||||||
|
|
||||||
done := make(chan bool)
|
done := make(chan bool)
|
||||||
taskMan = newTaskMan(2000)
|
taskMan = newTaskMan(cfg.Command.DelayMillSecond)
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
|
@@ -10,8 +10,7 @@ type FileGirl struct {
|
|||||||
ExceptDirs []string `yaml:"exceptDirs"`
|
ExceptDirs []string `yaml:"exceptDirs"`
|
||||||
}
|
}
|
||||||
Command struct {
|
Command struct {
|
||||||
//BeforeExec string `yaml:"beforeExec"`
|
Exec []string `yaml:"exec"`
|
||||||
Exec []string `yaml:"exec"`
|
DelayMillSecond int `yaml:"delayMillSecond"`
|
||||||
//AfterExec string `yaml:"afterExec"`
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
8
raw.go
8
raw.go
@@ -46,7 +46,13 @@ command:
|
|||||||
exec:
|
exec:
|
||||||
- go version
|
- go version
|
||||||
- go env
|
- go env
|
||||||
- echo {{file}}
|
|
||||||
|
# 文件变更后命令会在xx毫秒后才会执行,单位为毫秒
|
||||||
|
# 一个变更事件(A)如果在定义的延迟时间(t)内,又有新的文件变更事件(B),那么A会取消执行。
|
||||||
|
# B及以后的事件均依次类推,直到事件Z在t内没有新事件产生,Z 会执行
|
||||||
|
# 合理设置延迟时间,将有效减少冗余和重复任务的执行
|
||||||
|
# 如果不需要该特性,设置为 0
|
||||||
|
delayMillSecond: 1000
|
||||||
`
|
`
|
||||||
|
|
||||||
var firstRunHelp = `第一次运行 fileboy ?
|
var firstRunHelp = `第一次运行 fileboy ?
|
||||||
|
Reference in New Issue
Block a user