File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package server
2+
3+ import (
4+ "net/http"
5+
6+ "github.com/gin-gonic/gin"
7+ )
8+
9+ type UploadStats struct {
10+ FuncUnitTodo int `json:"funcUnitTodo"`
11+ FuncCtxUnitTodo int `json:"funcCtxUnitTodo"`
12+ }
13+
14+ // @Summary upload status query
15+ // @Produce json
16+ // @Success 200
17+ // @Router /api/v1/monitor/upload [get]
18+ func HandleStatusUpload (c * gin.Context ) {
19+ stat := & UploadStats {
20+ FuncUnitTodo : len (funcUnitQueue ),
21+ FuncCtxUnitTodo : len (funcCtxUnitQueue ),
22+ }
23+ c .JSON (http .StatusOK , stat )
24+ }
Original file line number Diff line number Diff line change @@ -78,14 +78,17 @@ func Execute(config ExecuteConfig) {
7878 engine .Handle (http .MethodGet , "/swagger/*any" , ginSwagger .WrapHandler (swaggerFiles .Handler ))
7979
8080 v1group := engine .Group ("/api/v1" )
81+ // query
8182 v1group .Handle (http .MethodGet , "/repo" , HandleRepoQuery )
8283 v1group .Handle (http .MethodGet , "/rev" , HandleRevQuery )
8384 v1group .Handle (http .MethodGet , "/file" , HandleFileQuery )
8485 v1group .Handle (http .MethodGet , "/func" , HandleFunctionsQuery )
8586 v1group .Handle (http .MethodGet , "/funcctx" , HandleFunctionCtxQuery )
86-
87+ // upload
8788 v1group .Handle (http .MethodPost , "/func" , HandleRepoFuncUpload )
8889 v1group .Handle (http .MethodPost , "/funcctx" , HandleFunctionContextUpload )
90+ // admin
91+ v1group .Handle (http .MethodGet , "/monitor/upload" , HandleStatusUpload )
8992
9093 err := engine .Run (fmt .Sprintf (":%d" , 9876 ))
9194 if err != nil {
You can’t perform that action at this time.
0 commit comments