log2json 0.1.16 → 0.1.17

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.
Files changed (3) hide show
  1. data/bin/redis2es +6 -11
  2. data/log2json.gemspec +1 -1
  3. metadata +1 -1
data/bin/redis2es CHANGED
@@ -131,22 +131,17 @@ def handle_redo_log
131
131
  # the main one or the temporary one, or both) is good, and produces only the main
132
132
  # redo log file to be retried.
133
133
  end
134
- i = 0
135
- record = ''
134
+ record = []
136
135
  File.open(REDO_LOG, "r:#{LOG_ENCODING}").each_line do |line|
137
136
  next if line == "\n" or line =~ /^#/
138
- if i % 2 == 0
139
- if not record.empty?
140
- @queue << record
141
- record = ''
142
- end
137
+ record << line
138
+ if record.size == 2
139
+ @queue << record.join('')
140
+ record.clear()
143
141
  if @queue.size == FLUSH_SIZE
144
142
  LOG.info("Flushing #{@queue.size} records from the redo log(#{REDO_LOG})...")
145
143
  flush_queue() rescue @queue.clear()
146
144
  end
147
- else
148
- record << line
149
- i += 1
150
145
  end
151
146
  end
152
147
  if not @queue.empty?
@@ -246,7 +241,7 @@ begin
246
241
  main()
247
242
  ensure
248
243
  LOG.warn("Terminating! Flusing the queue(size=#{@queue.size})...")
249
- flush_queue()
244
+ flush_queue() rescue :pass
250
245
  if File.exist?(REDO_LOG) and File.exist?(redo_tempfile_path)
251
246
  LOG.warn("Redo log file(#{REDO_LOG}) already exists!? " +
252
247
  "Please remove it so new redo logs can be written!")
data/log2json.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'log2json'
3
- s.version = '0.1.16'
3
+ s.version = '0.1.17'
4
4
  s.summary = "Read, filter and ship logs. ie, poor man's roll-your-own, light-weight logstash replacement."
5
5
  s.description = IO.read(File.join(File.dirname(__FILE__), 'README'))
6
6
  s.authors = ['Jack Kuan']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: log2json
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.17
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: