Skip to content

Commit

Permalink
fix: comments in neighbours function (#3069)
Browse files Browse the repository at this point in the history
Signed-off-by: fcgxz2003 <834756128@qq.com>
Signed-off-by: XZ <834756128@qq.com>
  • Loading branch information
fcgxz2003 committed Feb 7, 2024
1 parent bd57994 commit 3a05eb6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scheduler/networktopology/network_topology.go
Expand Up @@ -328,8 +328,8 @@ func (nt *networkTopology) ProbedCount(hostID string) (uint64, error) {
return probedCount, nil
}

// Neighbours gets the specified number neighbors of source host for aggregation, by regexp scaning cache
// (if it is not enough for code to work, access redis to get neighbors), then parsing keys and loading host,
// Neighbours gets the specified number neighbors of source host for aggregation by regexp scaning cache
// (if it is not enough for code to work, get neighbors from redis), then parsing keys and loading host,
// while updating the cache data.
func (nt *networkTopology) Neighbours(srcHost *resource.Host, n int) ([]*resource.Host, error) {
ctx, cancel := context.WithTimeout(context.Background(), contextTimeout)
Expand All @@ -340,7 +340,7 @@ func (nt *networkTopology) Neighbours(srcHost *resource.Host, n int) ([]*resourc
return nil, err
}

// If it is not enough for code to work, access redis to get neighbors.
// If it is not enough for code to work, get neighbors from redis.
if len(networkTopologyKeys) < n {
networkTopologyKeys, _, err = nt.rdb.Scan(ctx, 0, pkgredis.MakeNetworkTopologyKeyInScheduler(srcHost.ID, "*"), defaultScanCountLimit).Result()
if err != nil {
Expand Down

0 comments on commit 3a05eb6

Please sign in to comment.