Skip to content

Commit 133da65

Browse files
committed
fix: handle the uniqueness of client IDs when enabling codebase cleanup
1 parent 329056f commit 133da65

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

internal/dao/query/codebase.gen.go

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/job/cleaner.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"time"
66

7+
"github.com/google/uuid"
78
"github.com/robfig/cron/v3"
89
"github.com/zeromicro/go-zero/core/logx"
910
"github.com/zgsm-ai/codebase-indexer/internal/dao/model"
@@ -53,7 +54,7 @@ func NewCleaner(ctx context.Context, svcCtx *svc.ServiceContext) (Job, error) {
5354
}
5455

5556
// todo update db status, 唯一索引的存在(client_id、codebasePath),给client_id 加个唯一后缀,避免冲突。
56-
// cb.ClientID = cb.ClientID + "@" + uuid.New().String()
57+
cb.ClientID = cb.ClientID + "@" + uuid.New().String()
5758
cb.Status = string(model.CodebaseStatusExpired)
5859
if _, err = svcCtx.Querier.Codebase.WithContext(ctx).
5960
Where(svcCtx.Querier.Codebase.ID.Eq(cb.ID)).

0 commit comments

Comments
 (0)