Merge pull request #7953 from marten-seemann/fix-reqlog-race

fix race condition when logging requests
This commit is contained in:
Steven Allen 2021-03-03 18:13:54 -08:00 committed by GitHub
commit 65d9507c3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 1 deletions

View File

@ -117,7 +117,6 @@ func (c *Context) LogRequest(req *cmds.Request) func() {
Command: strings.Join(req.Path, "/"),
Options: req.Options,
Args: req.Arguments,
ID: c.ReqLog.nextID,
log: c.ReqLog,
}
c.ReqLog.AddEntry(rle)

View File

@ -38,6 +38,7 @@ func (rl *ReqLog) AddEntry(rle *ReqLogEntry) {
rl.lock.Lock()
defer rl.lock.Unlock()
rle.ID = rl.nextID
rl.nextID++
rl.Requests = append(rl.Requests, rle)