Skip to content

Commit

Permalink
fix grpc deprecations (#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
joschahenningsen committed Jan 4, 2022
1 parent 732d694 commit ed53f1b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions api_grpc/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/joschahenningsen/TUM-Live-Worker-v2/pb"
log "github.com/sirupsen/logrus"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/keepalive"
"google.golang.org/grpc/reflection"
"google.golang.org/protobuf/types/known/timestamppb"
Expand Down Expand Up @@ -413,7 +414,8 @@ func NotifyWorkers() {
}
workerIndex := getWorkerWithLeastWorkload(workers)
workers[workerIndex].Workload += 3
conn, err := grpc.Dial(fmt.Sprintf("%s:50051", workers[workerIndex].Host), grpc.WithInsecure())
credentials := insecure.NewCredentials()
conn, err := grpc.Dial(fmt.Sprintf("%s:50051", workers[workerIndex].Host), grpc.WithTransportCredentials(credentials))
if err != nil {
log.WithError(err).Error("Unable to dial server")
workers[workerIndex].Workload -= 1 // decrease workers load only by one (backoff)
Expand Down Expand Up @@ -460,7 +462,8 @@ func notifyWorkersPremieres() {
IngestServer: ingestServer.Url,
OutUrl: ingestServer.OutUrl,
}
conn, err := grpc.Dial(fmt.Sprintf("%s:50051", workers[workerIndex].Host), grpc.WithInsecure())
credentials := insecure.NewCredentials()
conn, err := grpc.Dial(fmt.Sprintf("%s:50051", workers[workerIndex].Host), grpc.WithTransportCredentials(credentials))
if err != nil {
log.WithError(err).Error("Unable to dial server")
_ = conn.Close()
Expand Down

0 comments on commit ed53f1b

Please sign in to comment.