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