
"""Factory to create grpc channel."""
# pytype: skip-file

import grpc


class GRPCChannelFactory(grpc.StreamStreamClientInterceptor):
  DEFAULT_OPTIONS = [("grpc.keepalive_time_ms", 20000)]

  def __init__(self):
    pass

  @staticmethod
  def insecure_channel(target, options=None):
    if options is None:
      options = []
    return grpc.insecure_channel(
        target, options=options + GRPCChannelFactory.DEFAULT_OPTIONS)

  @staticmethod
  def secure_channel(target, credentials, options=None):
    if options is None:
      options = []
    return grpc.secure_channel(
        target,
        credentials,
        options=options + GRPCChannelFactory.DEFAULT_OPTIONS)


"""Factory to create grpc channel."""
# pytype: skip-file

import grpc


class GRPCChannelFactory(grpc.StreamStreamClientInterceptor):
  DEFAULT_OPTIONS = [
      ("grpc.keepalive_time_ms", 20000),
      ("grpc.keepalive_timeout_ms", 300000),
  ]

  def __init__(self):
    pass

  @staticmethod
  def insecure_channel(target, options=None):
    if options is None:
      options = []
    return grpc.insecure_channel(
        target, options=options + GRPCChannelFactory.DEFAULT_OPTIONS)

  @staticmethod
  def secure_channel(target, credentials, options=None):
    if options is None:
      options = []
    return grpc.secure_channel(
        target,
        credentials,
        options=options + GRPCChannelFactory.DEFAULT_OPTIONS)

Increase keepalive timeout to 5 minutes.
Increase keepalive timeout to 5 minutes.

  
  """Factory to create grpc channel."""
  # pytype: skip-file
  
  import grpc
  
  
  class GRPCChannelFactory(grpc.StreamStreamClientInterceptor):
-   DEFAULT_OPTIONS = [("grpc.keepalive_time_ms", 20000)]
+   DEFAULT_OPTIONS = [
+       ("grpc.keepalive_time_ms", 20000),
+       ("grpc.keepalive_timeout_ms", 300000),
+   ]
  
    def __init__(self):
      pass
  
    @staticmethod
    def insecure_channel(target, options=None):
      if options is None:
        options = []
      return grpc.insecure_channel(
          target, options=options + GRPCChannelFactory.DEFAULT_OPTIONS)
  
    @staticmethod
    def secure_channel(target, credentials, options=None):
      if options is None:
        options = []
      return grpc.secure_channel(
          target,
          credentials,
          options=options + GRPCChannelFactory.DEFAULT_OPTIONS)
  
Increase keepalive timeout to 5 minutes.
## Code Before:

"""Factory to create grpc channel."""
# pytype: skip-file

import grpc


class GRPCChannelFactory(grpc.StreamStreamClientInterceptor):
  DEFAULT_OPTIONS = [("grpc.keepalive_time_ms", 20000)]

  def __init__(self):
    pass

  @staticmethod
  def insecure_channel(target, options=None):
    if options is None:
      options = []
    return grpc.insecure_channel(
        target, options=options + GRPCChannelFactory.DEFAULT_OPTIONS)

  @staticmethod
  def secure_channel(target, credentials, options=None):
    if options is None:
      options = []
    return grpc.secure_channel(
        target,
        credentials,
        options=options + GRPCChannelFactory.DEFAULT_OPTIONS)

## Instruction:
Increase keepalive timeout to 5 minutes.
## Code After:

"""Factory to create grpc channel."""
# pytype: skip-file

import grpc


class GRPCChannelFactory(grpc.StreamStreamClientInterceptor):
  DEFAULT_OPTIONS = [
      ("grpc.keepalive_time_ms", 20000),
      ("grpc.keepalive_timeout_ms", 300000),
  ]

  def __init__(self):
    pass

  @staticmethod
  def insecure_channel(target, options=None):
    if options is None:
      options = []
    return grpc.insecure_channel(
        target, options=options + GRPCChannelFactory.DEFAULT_OPTIONS)

  @staticmethod
  def secure_channel(target, credentials, options=None):
    if options is None:
      options = []
    return grpc.secure_channel(
        target,
        credentials,
        options=options + GRPCChannelFactory.DEFAULT_OPTIONS)
