Merge pull request #9302 from liuxu623/fix-fatal-error

fix fatal error
This commit is contained in:
Wenkai Yin(尹文开) 2019-10-25 13:16:54 +08:00 committed by GitHub
commit 28ee5f7d43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,6 +18,7 @@ import (
"context"
"fmt"
"math"
"sync"
"time"
"errors"
@ -45,6 +46,8 @@ type Context struct {
cfgMgr comcfg.CfgManager
// job life cycle tracker
tracker job.Tracker
// job logger configs settings map lock
lock sync.Mutex
}
// NewContext ...
@ -123,6 +126,8 @@ func (c *Context) Build(tracker job.Tracker) (job.Context, error) {
}
// Set loggers for job
c.lock.Lock()
defer c.lock.Unlock()
lg, err := createLoggers(tracker.Job().Info.JobID)
if err != nil {
return nil, err