Class: Resque::Kubernetes::RetriableClient

Inherits:
Object
  • Object
show all
Defined in:
lib/resque/kubernetes/retriable_client.rb

Overview

Wraps Kubeclient::Client to retry timeout errors

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ RetriableClient

Returns a new instance of RetriableClient.



9
10
11
# File 'lib/resque/kubernetes/retriable_client.rb', line 9

def initialize(client)
  self.kubeclient = client
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/resque/kubernetes/retriable_client.rb', line 13

def method_missing(method, *args, &block)
  if kubeclient.respond_to?(method)
    Retriable.retriable(on: {Kubeclient::HttpError => /Timed out/}) do
      kubeclient.send(method, *args, &block)
    end
  else
    super
  end
end

Instance Attribute Details

#kubeclientObject

Returns the value of attribute kubeclient.



7
8
9
# File 'lib/resque/kubernetes/retriable_client.rb', line 7

def kubeclient
  @kubeclient
end

Instance Method Details

#respond_to_missing?(method) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/resque/kubernetes/retriable_client.rb', line 23

def respond_to_missing?(method)
  kubeclient.respond_to?(method)
end