Skip to content

Commit

Permalink
fix(indexer): set grpc keepalive interval to 5min
Browse files Browse the repository at this point in the history
  • Loading branch information
Redm4x committed Aug 20, 2024
1 parent cdd4b7d commit 303b11d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions apps/indexer/src/providers/statusEndpointHandlers/grpc.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NodeResources, Storage } from "@akashnetwork/akash-api/akash/inventory/v1";
import { NodeResources } from "@akashnetwork/akash-api/akash/inventory/v1";
import { ResourcesMetric, Status } from "@akashnetwork/akash-api/akash/provider/v1";
import { ProviderRPCClient } from "@akashnetwork/akash-api/akash/provider/v1/grpc-js";
import { Empty } from "@akashnetwork/akash-api/google/protobuf";
Expand All @@ -9,6 +9,7 @@ import { promisify } from "util";
import { parseDecimalKubernetesString, parseSizeStr } from "@src/shared/utils/files";
import { FakeInsecureCredentials } from "./fake-insecure-credentials";
import { ProviderStatusInfo } from "./types";
import minutesToMilliseconds from "date-fns/minutesToMilliseconds";

export async function fetchProviderStatusFromGRPC(provider: Provider, timeout: number): Promise<ProviderStatusInfo> {
const data = await queryStatus(provider.hostUri, timeout);
Expand Down Expand Up @@ -104,7 +105,10 @@ const createProviderClient = memoize((hostUri: string) => {

// TODO: refactor to use on-change cert validation
// Issue: https://github.com/akash-network/console/issues/170
const client = new ProviderRPCClient(url, FakeInsecureCredentials.createInsecure());
const client = new ProviderRPCClient(url, FakeInsecureCredentials.createInsecure(), {
"grpc.keepalive_time_ms": minutesToMilliseconds(5),
"grpc.keepalive_permit_without_calls": 1
});
const getStatus = promisify(client.getStatus.bind(client));

return {
Expand Down

0 comments on commit 303b11d

Please sign in to comment.