Skip to content

Commit 22d784b

Browse files
YuaningaMandssS
authored andcommitted
fix: the file append experiment is unreasonable
Signed-off-by: Yuaninga <[email protected]>
1 parent 4da332d commit 22d784b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

exec/file/file_append.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func NewFileAppendActionSpec() spec.ExpActionCommandSpec {
5454
},
5555
&spec.ExpFlag{
5656
Name: "interval",
57-
Desc: "append interval, must be a positive integer, default 1s",
57+
Desc: "append interval, must be a positive integer",
5858
},
5959
&spec.ExpFlag{
6060
Name: "escape",
@@ -137,8 +137,8 @@ func (f *FileAppendActionExecutor) Exec(uid string, ctx context.Context, model *
137137

138138
// default 1
139139
count := 1
140-
// 1000 ms
141-
interval := 1
140+
// default 0
141+
interval := 0
142142

143143
content := model.ActionFlags["content"]
144144
countStr := model.ActionFlags["count"]
@@ -172,7 +172,10 @@ func (f *FileAppendActionExecutor) start(filepath string, content string, count
172172
if !response.Success {
173173
return response
174174
}
175-
175+
// Without interval, it will not be executed regularly.
176+
if interval < 1 {
177+
return nil
178+
}
176179
ticker := time.NewTicker(time.Second * time.Duration(interval))
177180
for range ticker.C {
178181
response := appendFile(f.channel, count, ctx, content, filepath, escape, enableBase64)

0 commit comments

Comments
 (0)