Use a fresh client to prevent connections from being reused (#4)

This commit is contained in:
Marco van Dijk 2022-10-19 10:10:34 +02:00 committed by GitHub
parent 5fa08800bf
commit d4e1c33702
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -171,7 +171,7 @@ function hexToBytes(hex) {
const discoverOrchestrator = async function (target) {
if (!target) { return; }
var client = new livepeerProto.Orchestrator(target, ssl_creds);
var client = new livepeerProto.Orchestrator(target, ssl_creds, {"GRPC_ARG_DEFAULT_AUTHORITY": Math.random().toString(36).substr(2, 5)});
var receivedResults = false;
var orchestratorInfo;
const start = new Date().getTime();
@ -191,6 +191,7 @@ const discoverOrchestrator = async function (target) {
receivedResults = true;
});
while (!receivedResults && new Date().getTime() - start < 4000) { await sleep(20); }
grpc.closeClient(client);
return { discoveryResults: orchestratorInfo, elapsed };
}