New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to make oink skip lines with bad character encoding #7

Open
wants to merge 4 commits into
base: master
from
Jump to file or symbol
Failed to load files and symbols.
+9 −5
Diff settings

Always

Just for now

Viewing a subset of changes. View all

begin/rescue encoding errors rather than transcoding all lines by def…

…ualt - it ends up being a lot faster in the average case
  • Loading branch information...
Shane Gibbons
Shane Gibbons committed Jan 14, 2011
commit e3a31bc74fead990401793fc32fc7077929eb807
@@ -2,7 +2,6 @@
require "oink/base"
require "oink/oinked_request/oinked_memory_request"
require "oink/priority_queue"
require "iconv"
module Oink
@@ -13,13 +12,18 @@ def print(output)
output.puts "\n-- REQUESTS --\n" if @format == :verbose
ic = Iconv.new('UTF-8//IGNORE', 'UTF-8')
@inputs.each do |input|
input.each_line do |line|
line = ic.iconv(line.strip + ' ')[0..-2]
line = line.strip
# Skip this line since we're only interested in the Hodel 3000 compliant lines
next unless line =~ HODEL_LOG_FORMAT_REGEX
# Skip this line since we're only interested in the Hodel 3000 compliant lines
# Also skip lines that have the wrong character encoding
begin
next unless line =~ HODEL_LOG_FORMAT_REGEX
rescue => e
output.puts "\nSkipping malformed line" if @format == :verbose and e =~ /invalid byte sequence/
next
end
if line =~ /rails\[(\d+)\]/
pid = $1
ProTip! Use n and p to navigate between commits in a pull request.