Open kybom opened 4 years ago
在本地运行,一调用接口就会出现panic
[GIN] 2020/05/21 - 15:06:57 | 200 | 454.237µs | 192.168.130.136 | GET "/api/hot_songs" 2020/05/21 15:07:28 [Recovery] 2020/05/21 - 15:07:28 panic recovered: GET /api/hot_songs?page_num=1&page_size=10 HTTP/1.1 Host: 192.168.130.123:8080 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9 Accept-Encoding: gzip, deflate Accept-Language: zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,ja;q=0.6 Connection: keep-alive Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36 elastic: Error 404 (Not Found): no such index [song] [type=index_not_found_exception] /home/king/workspace/gowork/hot-comment/search/search.go:133 (0xb91693) GetSongsByCommentCount: panic(err) /home/king/workspace/gowork/hot-comment/router/api/handler.go:64 (0xb9421f) GetHotSongs: data, code = search.GetSongsByCommentCount(pageNum, pageSize) /home/king/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/context.go:161 (0x967fca) (*Context).Next: c.handlers[c.index](c) /home/king/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/recovery.go:83 (0x97b39f) RecoveryWithWriter.func1: c.Next() /home/king/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/context.go:161 (0x967fca) (*Context).Next: c.handlers[c.index](c) /home/king/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/logger.go:241 (0x97a4d0) LoggerWithConfig.func1: c.Next() /home/king/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/context.go:161 (0x967fca) (*Context).Next: c.handlers[c.index](c) /home/king/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/gin.go:409 (0x971a75) (*Engine).handleHTTPRequest: c.Next() /home/king/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/gin.go:367 (0x97118c) (*Engine).ServeHTTP: engine.handleHTTPRequest(c) /usr/local/go/src/net/http/server.go:2807 (0x6db7c2) serverHandler.ServeHTTP: handler.ServeHTTP(rw, req) /usr/local/go/src/net/http/server.go:1895 (0x6d713b) (*conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req) /usr/local/go/src/runtime/asm_amd64.s:1373 (0x464620) goexit: BYTE $0x90 // NOP
需要在本地把elasticsearch也启动起来,数据是抓取的,后续我把一部分数据给传上来
在本地运行,一调用接口就会出现panic