logstash_writer 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/logstash_writer.rb +11 -7
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 581706d47cefad1062b70b5abf2e6689dac1671a3edbaeaad776bb4b8af8aa21
4
- data.tar.gz: f9c9e6939dfc94a8aad4c54ee175fc8d0f3a2b9d35a1a932ab5944df3c0267cc
3
+ metadata.gz: 9254bae4e4a6f114fd683a3509b576d272256e162ecc5722c8d1c7a78a3e25e3
4
+ data.tar.gz: 9e61badc96a9bc3028a15311117eb95b6d3f37c7c59d950d66fe76d223160363
5
5
  SHA512:
6
- metadata.gz: b019d96a15b990080f0afc0fc0f9d5dad69644d92338e07dde8eabc9dece477e88f207a8b6f78e49be6a910351826c8640b51b52475589ad5d888320ee8d0f02
7
- data.tar.gz: f7c747495bd1823e3f62d52f88b33b60e7df0039242c874333d94462d9b3a7d9f88cc14a0a28b9857cf8a3729b02dbe93f1990c642a51b2910380ccbbad43d8f
6
+ metadata.gz: 97ebc1f452ecc063b81e534ffb87e62ac4f225101454494ad8058abc18cef6427986b93a8643bc87631fdbde9d629dbebb35a51936f403a20e2d84b5517086b5
7
+ data.tar.gz: 01f8be94cee73a68b228e69f55f4f2d8e6448f8d37d885427a741cb8786f4c8fc37e1a99567ee92c8133f27e3faded0f6b3b1ca19cfe0bc382696682b281b6c7
@@ -121,7 +121,7 @@ class LogstashWriter
121
121
  end
122
122
 
123
123
  if e.has_key?("@metadata")
124
- e[:@metadata] = (e[:@metadata] || {}).merge(e["@metadata"])
124
+ e[:@metadata] = (e[:@metadata] || {}).merge(e.delete("@metadata"))
125
125
  end
126
126
 
127
127
  unless e.has_key?(:@metadata)
@@ -285,16 +285,20 @@ class LogstashWriter
285
285
  @socket_mutex.synchronize do
286
286
  if @current_target
287
287
  begin
288
- # Check that our socket is still good to go; if we don't do this,
289
- # the other end can disconnect, and because we're never normally
290
- # reading from the socket, we never get the EOFError that normally
291
- # results, and so the socket remains in CLOSE_WAIT state *forever*.
292
- @current_target.socket.read_nonblock(1)
288
+ # Check that our socket is still good to go; if we don't do
289
+ # this, the other end can disconnect, and because we're never
290
+ # normally reading from the socket, we never get the EOFError
291
+ # that normally results, and so the socket remains in CLOSE_WAIT
292
+ # state *forever*. raising an ENOTCONN gets us into the
293
+ # SystemCallError rescue, which is where we want to be, and
294
+ # "Transport endpoint is not connected" seems like a suitably
295
+ # appropriate error to me under the circumstances.
296
+ raise Errno::ENOTCONN unless IO.select([@current_target.socket], [], [], 0).nil?
293
297
 
294
298
  yield @current_target
295
299
  @metrics[:connected].set({ server: @current_target.describe_peer }, 1)
296
300
  done = true
297
- rescue SystemCallError, IOError => ex
301
+ rescue SystemCallError => ex
298
302
  # Something went wrong during the send; disconnect from this
299
303
  # server and recycle
300
304
  @metrics[:write_exception].increment(server: @current_target.describe_peer, class: ex.class.to_s)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash_writer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Palmer