Skip to content

Commit

Permalink
fix: data racing in user poll log marks
Browse files Browse the repository at this point in the history
  • Loading branch information
greenhat616 committed Sep 11, 2023
1 parent 57a8f8b commit 3193477
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
13 changes: 1 addition & 12 deletions internal/logic/poll/poll_mark.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ package poll

import (
"context"
"reflect"
"strconv"
"time"

"github.com/gogf/gf/v2/frame/g"

"github.com/gogf/gf/v2/util/gconv"

"github.com/gogf/gf/v2/database/gdb"
Expand Down Expand Up @@ -59,15 +56,7 @@ func (s *sPoll) GetPollMarksByPollIDAndUserID(ctx context.Context, pid, userID i
if err != nil {
return nil, err
}
g.Log().Debugf(
ctx,
"pid: %d, uid %d, gconv: %+v, marks: %+v, type: %s",
pid,
userID,
gconv.Ints(marks),
marks,
reflect.ValueOf(marks).Type().String(),
)

if len(marks) == 0 {
return make([]int, 0), nil
}
Expand Down
6 changes: 2 additions & 4 deletions internal/logic/user/poll_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,8 @@ func (s *sUser) GetUserPollLogsWithSentence(
if e != nil {
return e
}
userPollLogs[index] = model.UserPollLogWithSentenceAndUserMarks{
UserPollLog: value,
Sentence: sentence,
}
userPollLogs[index].UserPollLog = value
userPollLogs[index].Sentence = sentence
return nil
})
}
Expand Down

0 comments on commit 3193477

Please sign in to comment.