chore: remove gRPC listener (#2456)

Disable gRPC listener
This commit is contained in:
Athurg Gooth 2023-10-27 21:38:17 +08:00 committed by GitHub
parent 76d955a69a
commit 0f4e5857f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,6 @@ import (
"context"
"encoding/json"
"fmt"
"net"
"net/http"
"strings"
"time"
@ -14,11 +13,9 @@ import (
"github.com/labstack/echo/v4/middleware"
"github.com/pkg/errors"
echoSwagger "github.com/swaggo/echo-swagger"
"go.uber.org/zap"
apiv1 "github.com/usememos/memos/api/v1"
apiv2 "github.com/usememos/memos/api/v2"
"github.com/usememos/memos/internal/log"
"github.com/usememos/memos/plugin/telegram"
"github.com/usememos/memos/server/integration"
"github.com/usememos/memos/server/profile"
@ -122,17 +119,6 @@ func (s *Server) Start(ctx context.Context) error {
go s.telegramBot.Start(ctx)
go s.backupRunner.Run(ctx)
// Start gRPC server.
listen, err := net.Listen("tcp", fmt.Sprintf("%s:%d", s.Profile.Addr, s.Profile.Port+1))
if err != nil {
return err
}
go func() {
if err := s.apiV2Service.GetGRPCServer().Serve(listen); err != nil {
log.Error("grpc server listen error", zap.Error(err))
}
}()
metric.Enqueue("server start")
return s.e.Start(fmt.Sprintf("%s:%d", s.Profile.Addr, s.Profile.Port))
}