Close client after each call to prevent too many open files error on O's

This commit is contained in:
Marco van Dijk 2022-10-19 09:47:03 +02:00
parent edc0c3d710
commit 15d02182e2

View File

@ -171,7 +171,6 @@ 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;
@ -192,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 };
}