Skip to content

Commit ebdda39

Browse files
committed
feat(be): add delay before run task
1 parent 42db539 commit ebdda39

File tree

4 files changed

+6
-675
lines changed

4 files changed

+6
-675
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ web/.nyc_output
99
api/public/**/*
1010
/server.json
1111
/config.json
12+
/config-secondary.json
1213
/config.runner.json
1314
/config.runner.token
1415
/config.runner.key

services/tasks/RemoteJob.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,7 @@ func (t *RemoteJob) Run(username string, incomingVersion *string, alias string)
9494
tsk.IncomingVersion = incomingVersion
9595
tsk.Username = username
9696
tsk.Alias = alias
97-
if t.taskPool != nil && t.taskPool.state != nil {
98-
t.taskPool.state.UpdateRuntimeFields(tsk)
99-
}
97+
t.taskPool.state.UpdateRuntimeFields(tsk)
10098

10199
var runners []db.Runner
102100
db.StoreSession(t.taskPool.store, "run remote job", func() {

services/tasks/TaskPool.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,10 @@ func runTask(task *TaskRunner, p *TaskPool) {
274274
p.onTaskRun(task)
275275

276276
log.Info("Task " + strconv.Itoa(task.Task.ID) + " started")
277-
go task.run()
277+
go func() {
278+
time.Sleep(1 * time.Second)
279+
task.run()
280+
}()
278281
}
279282

280283
func (p *TaskPool) onTaskRun(t *TaskRunner) {

0 commit comments

Comments
 (0)