Skip to content

Commit 0e5fa66

Browse files
authored
handle connection error (#63)
1 parent 0a9215d commit 0e5fa66

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

Gemfile.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
fluent-plugin-kubernetes-objects (1.1.6)
4+
fluent-plugin-kubernetes-objects (1.1.7)
55
fluentd (>= 1.9.1)
66
http_parser.rb (= 0.5.3)
77
kubeclient (~> 4.6.0)
@@ -106,4 +106,4 @@ DEPENDENCIES
106106
webmock (~> 3.5)
107107

108108
BUNDLED WITH
109-
2.2.23
109+
2.2.24

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.6
1+
1.1.7

lib/fluent/plugin/in_kubernetes_objects.rb

+12-8
Original file line numberDiff line numberDiff line change
@@ -245,15 +245,19 @@ def create_watcher_thread(conf)
245245
while thread_current_running?
246246
@client.public_send("watch_#{resource_name}", options).tap do |watcher|
247247
tag = generate_tag "#{resource_name}"
248-
watcher.each do |entity|
249-
begin
250-
entity = JSON.parse(entity)
251-
router.emit tag, Fluent::Engine.now, entity
252-
options[:resource_version] = entity['object']['metadata']['resourceVersion']
253-
@storage.put resource_name, entity['object']['metadata']['resourceVersion']
254-
rescue => e
255-
log.info "Got exception #{e} parsing entity #{entity}. Resetting watcher."
248+
begin
249+
watcher.each do |entity|
250+
begin
251+
entity = JSON.parse(entity)
252+
router.emit tag, Fluent::Engine.now, entity
253+
options[:resource_version] = entity['object']['metadata']['resourceVersion']
254+
@storage.put resource_name, entity['object']['metadata']['resourceVersion']
255+
rescue => e
256+
log.info "Got exception #{e} parsing entity #{entity}. Resetting watcher."
257+
end
256258
end
259+
rescue => e
260+
log.info "Got exception #{e}. Resetting watcher."
257261
end
258262
end
259263
end

0 commit comments

Comments
 (0)