fluent-plugin-mongo 0.7.6 → 0.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 119b5490b51050d354eebb300b2f70caddd469dd
4
- data.tar.gz: 0a6e35ed0fefd3babe866e1deb4c5cff102ac3c3
3
+ metadata.gz: e1b44afa9a00bcc44e988c6ff186cef45226f59c
4
+ data.tar.gz: 72818ef49d77f1eb77c58a421a528a53142302fe
5
5
  SHA512:
6
- metadata.gz: f5bcf318f62c42637c223fcb4411f46429b836d724ab6128c6e3970751d0c444db988ef64647e5695c20397ed1253eefca1b7488d7c7b2530530b2ef747c6312
7
- data.tar.gz: badeea8a1111a1b5406ee26ab9c78814b6beac8ceff0304fd203b2222775bef45f9f7e18ecfa56e2b7d03d45a1d554ee7b9ed5ea1320ac445be17b764812e13d
6
+ metadata.gz: f41c96c14b596e8bb394f5e94045f84272f104c2d8848f4f761c265c3c33ee69803638af0b7ada30a604574817bbca813f4326edad15f5607c16287cc23efc51
7
+ data.tar.gz: 6b31e68117d8ea3a5465ac02804c6e8a1d71f42cdb4b855c520eff1b9273a967acf3b12661113b93a265963ad1bfd4121cf7d6573a7894a71129bcddb7736bf4
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ Release 0.7.7 - 2015/03/19
2
+
3
+ * Fix in_mongo_tail shutdown mechanizm for handling stop sequence correctly.
4
+
5
+
1
6
  Release 0.7.6 - 2015/02/12
2
7
 
3
8
  * Relax fluentd dependency to support v0.12 or later
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.6
1
+ 0.7.7
@@ -60,6 +60,7 @@ module Fluent
60
60
  @file.close
61
61
  end
62
62
 
63
+ @stop = true
63
64
  @thread.join
64
65
  @client.db.connection.close
65
66
  super
@@ -67,7 +68,21 @@ module Fluent
67
68
 
68
69
  def run
69
70
  loop {
70
- tailoop(Mongo::Cursor.new(@client, cursor_conf))
71
+ cursor = Mongo::Cursor.new(@client, cursor_conf)
72
+ begin
73
+ loop {
74
+ return if @stop
75
+
76
+ cursor = Mongo::Cursor.new(@client, cursor_conf) unless cursor.alive?
77
+ if doc = cursor.next_document
78
+ process_document(doc)
79
+ else
80
+ sleep @wait_time
81
+ end
82
+ }
83
+ rescue
84
+ # ignore Mongo::OperationFailuer at CURSOR_NOT_FOUND
85
+ end
71
86
  }
72
87
  end
73
88
 
@@ -89,36 +104,27 @@ module Fluent
89
104
  end
90
105
  end
91
106
 
92
- def tailoop(cursor)
93
- loop {
94
- cursor = Mongo::Cursor.new(@client, cursor_conf) unless cursor.alive?
95
- if doc = cursor.next_document
96
- time = if @time_key
97
- t = doc.delete(@time_key)
98
- t.nil? ? Engine.now : t.to_i
99
- else
100
- Engine.now
101
- end
102
- tag = if @tag_key
103
- t = doc.delete(@tag_key)
104
- t.nil? ? 'mongo.missing_tag' : t
105
- else
106
- @tag
107
- end
108
- if id = doc.delete('_id')
109
- @last_id = id.to_s
110
- doc['_id_str'] = @last_id
111
- save_last_id if @id_store_file
112
- end
113
-
114
- # Should use MultiEventStream?
115
- Engine.emit(tag, time, doc)
116
- else
117
- sleep @wait_time
118
- end
119
- }
120
- rescue
121
- # ignore Mongo::OperationFailuer at CURSOR_NOT_FOUND
107
+ def process_document(doc)
108
+ time = if @time_key
109
+ t = doc.delete(@time_key)
110
+ t.nil? ? Engine.now : t.to_i
111
+ else
112
+ Engine.now
113
+ end
114
+ tag = if @tag_key
115
+ t = doc.delete(@tag_key)
116
+ t.nil? ? 'mongo.missing_tag' : t
117
+ else
118
+ @tag
119
+ end
120
+ if id = doc.delete('_id')
121
+ @last_id = id.to_s
122
+ doc['_id_str'] = @last_id
123
+ save_last_id if @id_store_file
124
+ end
125
+
126
+ # Should use MultiEventStream?
127
+ Engine.emit(tag, time, doc)
122
128
  end
123
129
 
124
130
  def cursor_conf
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-mongo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.6
4
+ version: 0.7.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro Nakagawa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-12 00:00:00.000000000 Z
11
+ date: 2015-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd