Browse Source

graph2: Fixed data race in change logging for importLog.

module-madness-pointers
Gisle Aune 6 years ago
parent
commit
c5b62a42db
  1. 4
      graph2/queries/log.go

4
graph2/queries/log.go

@ -125,10 +125,10 @@ func (r *mutationResolver) ImportLog(ctx context.Context, input input.LogImportI
newLogs := make([]models.Log, 0, len(results)) newLogs := make([]models.Log, 0, len(results))
for _, result := range results { for _, result := range results {
go func() {
go func(result logs.ImportedLog) {
changes.Submit("Log", "add", token.UserID, true, changekeys.Many(result.Log), result.Log) changes.Submit("Log", "add", token.UserID, true, changekeys.Many(result.Log), result.Log)
changes.Submit("Post", "add", token.UserID, true, changekeys.Many(result.Log, result.Posts), result.Posts) changes.Submit("Post", "add", token.UserID, true, changekeys.Many(result.Log, result.Posts), result.Posts)
}()
}(result)
log, err := logs.UpdateCharacters(result.Log, nil) log, err := logs.UpdateCharacters(result.Log, nil)
if err != nil { if err != nil {

Loading…
Cancel
Save