Skip to content

Commit

Permalink
Changes allocation script to only create one client
Browse files Browse the repository at this point in the history
and for the client to create multiple allocations
  • Loading branch information
igooch committed Dec 19, 2024
1 parent d6bee84 commit 8a7c819
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 8 additions & 1 deletion examples/allocator-client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,14 @@ func main() {
defer conn.Close()

grpcClient := pb.NewAllocationServiceClient(conn)
response, err := grpcClient.Allocate(context.Background(), request)

for i := 0; i < 1000; i++ {
allocateGameServer(grpcClient, request)
}
}

func allocateGameServer(client pb.AllocationServiceClient, request *pb.AllocationRequest) {
response, err := client.Allocate(context.Background(), request)
if err != nil {
panic(err)
}
Expand Down
6 changes: 4 additions & 2 deletions tmp/allocate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ TLS_CA_FILE=ca.crt

echo "Starting go runs"

for _ in {1..1000}; do
run_allocator_client () {
go run ../examples/allocator-client/main.go \
--ip "${EXTERNAL_IP}" \
--port 443 \
--namespace "${NAMESPACE}" \
--key "${KEY_FILE}" \
--cert "${CERT_FILE}" \
--cacert "${TLS_CA_FILE}"
done
}

run_allocator_client
wait
echo "All done"

0 comments on commit 8a7c819

Please sign in to comment.