Skip to content

Commit

Permalink
Use a unque grpc gateway socket name (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-at-luther authored Aug 23, 2024
1 parent 0b0c86c commit a55dac3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion oracle/oraclerun.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ package oracle

import (
"context"
"crypto/rand"
"fmt"
"math"
"math/big"
"net"
"net/http"
"strings"
Expand Down Expand Up @@ -153,8 +156,14 @@ func (orc *Oracle) StartGateway(ctx context.Context, grpcConfig GrpcGatewayConfi
"listen_address": orc.cfg.ListenAddress,
}).Infof("starting oracle")

nBig, err := rand.Int(rand.Reader, big.NewInt(math.MaxInt32))
if err != nil {
panic(err)
}

// Start a grpc server listening on the unix socket at grpcAddr
grpcAddr := "/tmp/oracle.grpc.sock"
grpcAddr := fmt.Sprintf("/tmp/oracle.grpc.%d.sock", nBig.Int64())

grpcServer := grpc.NewServer(
grpc.StatsHandler(otelgrpc.NewServerHandler()),
grpc.UnaryInterceptor(grpcmiddleware.ChainUnaryServer(
Expand Down

0 comments on commit a55dac3

Please sign in to comment.