@@ -19,6 +19,7 @@ package restapi
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/swag"
|
||||
@@ -28,7 +29,7 @@ import (
|
||||
)
|
||||
|
||||
func registerAdminInfoHandlers(api *operations.McsAPI) {
|
||||
// session check
|
||||
// return usage stats
|
||||
api.AdminAPIAdminInfoHandler = admin_api.AdminInfoHandlerFunc(func(params admin_api.AdminInfoParams, principal *models.Principal) middleware.Responder {
|
||||
infoResp, err := getAdminInfoResponse()
|
||||
if err != nil {
|
||||
@@ -71,7 +72,7 @@ func getAdminInfoResponse() (*models.AdminInfoResponse, error) {
|
||||
// defining the client to be used
|
||||
adminClient := adminClient{client: mAdmin}
|
||||
// 20 seconds timeout
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 20)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
|
||||
defer cancel()
|
||||
// serialize output
|
||||
usage, err := getAdminInfo(ctx, adminClient)
|
||||
|
||||
Reference in New Issue
Block a user