Skip to content

Commit

Permalink
fix:服务列表支持服务可见性&修复服务可见性优先级判断
Browse files Browse the repository at this point in the history
  • Loading branch information
chuntaojun committed Nov 29, 2024
1 parent 722ebbf commit 48e8510
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 3 additions & 2 deletions service/client_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,9 @@ func (s *Server) GetServiceWithCache(ctx context.Context, req *apiservice.Servic
revisions = append(revisions, visibleSvcs[i].Revision)
}
if rever, err := cachetypes.CompositeComputeRevision(revisions); err != nil {
// 如果计算失败,直接返回一个新的revision
revision = utils.NewUUID()
log.Errorf("[Server][Discover] list services compute multi revision",

Check failure on line 187 in service/client_v1.go

View workflow job for this annotation

GitHub Actions / golangci-lint (1.21.5)

printf: (*github.com/polarismesh/polaris/common/log.Scope).Errorf call has arguments but no formatting directives (govet)

Check failure on line 187 in service/client_v1.go

View workflow job for this annotation

GitHub Actions / build

(*github.com/polarismesh/polaris/common/log.Scope).Errorf call has arguments but no formatting directives
zap.String("namespace", req.GetNamespace().GetValue()), zap.Error(err))
return api.NewDiscoverInstanceResponse(apimodel.Code_ExecuteException, req)
} else {

Check warning on line 190 in service/client_v1.go

View workflow job for this annotation

GitHub Actions / golangci-lint (1.21.5)

indent-error-flow: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary) (revive)
revision = rever
}
Expand Down
7 changes: 3 additions & 4 deletions store/mysql/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,6 @@ func callFetchServiceRows(rows *sql.Rows, callback func(entry *model.Service) (b
}
defer rows.Close()

var ctime, mtime int64
var flag int
progress := 0
for rows.Next() {
Expand All @@ -1063,7 +1062,7 @@ func callFetchServiceRows(rows *sql.Rows, callback func(entry *model.Service) (b
var exportTo string
err := rows.Scan(
&item.ID, &item.Name, &item.Namespace, &item.Business, &item.Comment,
&item.Token, &item.Revision, &item.Owner, &flag, &ctime, &mtime, &item.Ports,
&item.Token, &item.Revision, &item.Owner, &flag, &item.Ctime, &item.Mtime, &item.Ports,
&item.Department, &item.CmdbMod1, &item.CmdbMod2, &item.CmdbMod3,
&item.Reference, &item.ReferFilter, &item.PlatformID, &exportTo)

Expand All @@ -1072,8 +1071,8 @@ func callFetchServiceRows(rows *sql.Rows, callback func(entry *model.Service) (b
return err
}

item.CreateTime = time.Unix(ctime, 0)
item.ModifyTime = time.Unix(mtime, 0)
item.CreateTime = time.Unix(item.Ctime, 0)
item.ModifyTime = time.Unix(item.Mtime, 0)
item.ExportTo = map[string]struct{}{}
_ = json.Unmarshal([]byte(exportTo), &item.ExportTo)
item.Valid = true
Expand Down

0 comments on commit 48e8510

Please sign in to comment.