From 8d8ab3ee1913d3b4c5e8c94b83cbff11a2918ce5 Mon Sep 17 00:00:00 2001 From: Geapefurit <670884108@qq.com> Date: Thu, 9 Nov 2023 10:30:15 +0800 Subject: [PATCH] check lint --- block-etl/pkg/chains/sol/index.go | 8 +------ main.go | 40 ------------------------------- ranker/api/v1/token/search.go | 8 ++++--- 3 files changed, 6 insertions(+), 50 deletions(-) delete mode 100644 main.go diff --git a/block-etl/pkg/chains/sol/index.go b/block-etl/pkg/chains/sol/index.go index fcded662..61fef8e0 100644 --- a/block-etl/pkg/chains/sol/index.go +++ b/block-etl/pkg/chains/sol/index.go @@ -70,13 +70,7 @@ func (e *SolIndexer) StartIndex(ctx context.Context) { e.onIndex = true // TODO: can be muilti goroutine - // go e.IndexTasks(ctx, taskBlockNum) - go func() { - for i := uint64(203773000); i < 203773100; i++ { - taskBlockNum <- i - } - }() - + go e.IndexTasks(ctx, taskBlockNum) go e.IndexBlock(ctx, taskBlockNum, indexBlockNum) go e.IndexTransfer(ctx, indexBlockNum, outTransfers) go e.IndexToken(ctx, outTransfers, outTransfer) diff --git a/main.go b/main.go deleted file mode 100644 index 297f7cbe..00000000 --- a/main.go +++ /dev/null @@ -1,40 +0,0 @@ -package main - -import ( - "context" - "os" - "os/signal" - "syscall" - - "github.com/NpoolPlatform/go-service-framework/pkg/logger" - "github.com/web3eye-io/Web3Eye/block-etl/pkg/chains/sol" - "github.com/web3eye-io/Web3Eye/nft-meta/pkg/db" - // rankernpool "github.com/web3eye-io/Web3Eye/proto/web3eye/ranker/v1/token" -) - -func main() { - sigchan := make(chan os.Signal, 1) - signal.Notify(sigchan, syscall.SIGINT, syscall.SIGTERM) - - // h, err := sol.GetEndpointChainID(context.TODO(), "https://distinguished-floral-mountain.solana-mainnet.discover.quiknode.pro/c641daff8873a3f24f2f4c90aae89373707c2886/") - // fmt.Println(h, err) - logger.Init(logger.DebugLevel, "./a.log") - db.Init() - // server := token.Server{} - // ret, err := server.Search(context.Background(), &rankernpool.SearchTokenRequest{ - // Vector: []float32{}, - // Limit: 100, - // }) - - // if err != nil { - // fmt.Println(err) - // } - - // fmt.Println(len(ret.Infos)) - - indexer := sol.NewIndexer("5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d") - indexer.Endpoints = []string{"https://distinguished-floral-mountain.solana-mainnet.discover.quiknode.pro/c641daff8873a3f24f2f4c90aae89373707c2886/"} - indexer.StartIndex(context.Background()) - <-sigchan - os.Exit(1) -} diff --git a/ranker/api/v1/token/search.go b/ranker/api/v1/token/search.go index af039b91..cd07b2c3 100644 --- a/ranker/api/v1/token/search.go +++ b/ranker/api/v1/token/search.go @@ -175,6 +175,8 @@ func sortSroces(scores map[int64]float32) []*ScoreItem { return topScores } +// TODO:too long,will be rewrite +//nolint:all func QueryAndCollectTokens(ctx context.Context, scores map[int64]float32, topN int) ([]*rankernpool.SearchToken, error) { topScores := sortSroces(scores) result := []*rankernpool.SearchToken{} @@ -216,9 +218,9 @@ func QueryAndCollectTokens(ctx context.Context, scores map[int64]float32, topN i infos = append(infos, info) } - // sort.Slice(infos, func(i, j int) bool { - // return infos[i].Distance < infos[j].Distance - // }) + sort.Slice(infos, func(i, j int) bool { + return infos[i].Distance < infos[j].Distance + }) // collection for _, v := range infos {