Skip to content

Commit d631204

Browse files
fix race condition when logging requests
1 parent ac82ca5 commit d631204

File tree

2 files changed

+1
-1
lines changed

2 files changed

+1
-1
lines changed

commands/context.go

-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ func (c *Context) LogRequest(req *cmds.Request) func() {
117117
Command: strings.Join(req.Path, "/"),
118118
Options: req.Options,
119119
Args: req.Arguments,
120-
ID: c.ReqLog.nextID,
121120
log: c.ReqLog,
122121
}
123122
c.ReqLog.AddEntry(rle)

commands/reqlog.go

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ func (rl *ReqLog) AddEntry(rle *ReqLogEntry) {
3838
rl.lock.Lock()
3939
defer rl.lock.Unlock()
4040

41+
rle.ID = rl.nextID
4142
rl.nextID++
4243
rl.Requests = append(rl.Requests, rle)
4344

0 commit comments

Comments
 (0)