Skip to content

Commit

Permalink
fix: cache issue
Browse files Browse the repository at this point in the history
  • Loading branch information
greenhat616 committed Sep 20, 2023
1 parent 1d23d42 commit 716e8d8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/logic/job/poll/remove_invalid_polls.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func RemoveInvalidPolls(ctx context.Context) error {
g.Log().Debugf(ctx, "投票 %d: 更新状态失败,可能是因为已经被其他人处理了。", poll.ID)
continue
}
go service.Cache().ClearCacheAfterPollUpdated(ctx, 0, poll.ID, poll.SentenceUUID) // 清除缓存
service.Cache().ClearCacheAfterPollUpdated(ctx, 0, poll.ID, poll.SentenceUUID) // 清除缓存
} else {
g.Log().Debugf(ctx, "投票 %d: 句子 %s 状态为 %s,属于有效投票,跳过……", poll.ID, poll.Sentence.UUID, poll.Sentence.Status)
}
Expand Down
6 changes: 3 additions & 3 deletions internal/logic/poll/poll.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (s *sPoll) CreatePollByPending(ctx context.Context, pending *entity.Pending
if err != nil {
return nil, err
}
go service.Cache().ClearCacheAfterPollUpdated(ctx, 0, uint(poll.Id), poll.SentenceUuid)
service.Cache().ClearCacheAfterPollUpdated(ctx, 0, uint(poll.Id), poll.SentenceUuid)
return poll, nil
}

Expand Down Expand Up @@ -378,7 +378,7 @@ func (s *sPoll) Poll(ctx context.Context, in *model.PollInput) error {
return gerror.Wrap(err, "poll failed")
}
// Remove caches
go service.Cache().ClearCacheAfterPollUpdated(ctx, in.UserID, in.PollID, in.SentenceUUID)
service.Cache().ClearCacheAfterPollUpdated(ctx, in.UserID, in.PollID, in.SentenceUUID)
return nil
}

Expand Down Expand Up @@ -454,7 +454,7 @@ func (s *sPoll) CancelPollByID(ctx context.Context, in *model.CancelPollInput) e
if err != nil {
return gerror.Wrap(err, "cancel poll failed")
}
go service.Cache().ClearCacheAfterPollUpdated(ctx, in.UserID, in.PollID, in.SentenceUUID)
service.Cache().ClearCacheAfterPollUpdated(ctx, in.UserID, in.PollID, in.SentenceUUID)
return nil
}

Expand Down

0 comments on commit 716e8d8

Please sign in to comment.