How to disable automatic grpc calls when temporal cluster is exited?

Hi
I have started a local development cluster using the following command temporal server start-dev
and my application is in nestjs so i have written a provider for the workflow client given as below :

export const TemporalClientProvider: Provider = {
  provide: TEMPORAL_CLIENT,
  inject: [LoggerService, ConfigService],
  async useFactory(logger: LoggerService, configService: ConfigService) {
    try {
      const connection = await Connection.connect({
        address: `${configService.get('TEMPORAL_CLUSTER_IP_ADDRESS')}:${
          configService.get('TEMPORAL_CLUSTER_PORT') || '7233'
        }`,
      });
      return new WorkflowClient({
        connection,
        namespace: configService.get('TEMPORAL_CLUSTER_NAMESPACE'),
        interceptors: [],
      });
    } catch (err) {
      logger.error(`Failed to connect to the temporal server. Error - ${err}`);
    }
  },
};

i have put the interceptors as an empty array so that no grpc calls are called when i exit from the cluster but as soon as i exit from the cluster, i see a list of temporal_client::retry warnings

2024-02-14T04:53:40.064886Z  WARN temporal_client::retry: gRPC call poll_activity_task_queue retried 11 times error=Status { code: Unavailable, message: "error trying to connect: tcp connect error: Connection refused (os error 111)", source: Some(tonic::transport::Error(Transport, hyper::Error(Connect, ConnectError("tcp connect error", Os { code: 111, kind: ConnectionRefused, message: "Connection refused" })))) }
2024-02-14T04:53:40.683978Z  WARN temporal_client::retry: gRPC call poll_workflow_task_queue retried 12 times error=Status { code: Unavailable, message: "error trying to connect: tcp connect error: Connection refused (os error 111)", source: Some(tonic::transport::Error(Transport, hyper::Error(Connect, ConnectError("tcp connect error", Os { code: 111, kind: ConnectionRefused, message: "Connection refused" })))) }

Here poll_workflow_task_queue and poll_activity_task_queue are automatically called and retried as soon as i terminate the cluster
how do i make sure that the calls are only retried for a specific amount of times and after that amount, i would like to exit from my application as well

Thanks and Regards,
Rahul

This isn’t the client making calls, it’s the worker via the NativeConnection.

The worker polls for workflow and activity tasks in the background and run will throw an error after a while where there’s no communication with the server.