Fix a comment issue and early return for prs

This commit is contained in:
Chongyi Zheng 2023-08-24 15:51:26 -04:00
parent 9bfd3e309e
commit e39d0ff61f
No known key found for this signature in database
GPG Key ID: E3C2287691E40E35
1 changed files with 6 additions and 2 deletions

View File

@ -302,8 +302,8 @@ func UpsertIssueComments(ctx context.Context, comments []*issues_model.Comment)
sess := db.GetEngine(ctx)
for _, comment := range comments {
exists, err := sess.Exist(&issues_model.Comment{
IssueID: comment.IssueID,
CreatedUnix: comment.CreatedUnix,
IssueID: comment.IssueID,
OriginalID: comment.OriginalID,
})
if err != nil {
return err
@ -383,6 +383,10 @@ func InsertPullRequests(ctx context.Context, prs ...*issues_model.PullRequest) e
// UpsertPullRequests inserts new pull requests and updates existing pull requests in database
func UpsertPullRequests(ctx context.Context, prs ...*issues_model.PullRequest) error {
if len(prs) == 0 {
return nil
}
return db.WithTx(ctx, func(ctx context.Context) error {
sess := db.GetEngine(ctx)
for _, pr := range prs {