Skip to content

Instantly share code, notes, and snippets.

@yosiat
Last active December 15, 2015 07:59
Show Gist options
  • Save yosiat/5227250 to your computer and use it in GitHub Desktop.
Save yosiat/5227250 to your computer and use it in GitHub Desktop.
class ImportWorker
include Sidekiq::Worker
include Sidekiq::Status::Worker
def get_command
# This command just returns the "git-tf clone .." command, getting from config file the paramters
# and concating all
command
end
def perform
IO.popen(get_command) do |stdin,stdout|
chars = []
last_percent = 0
while(char = stdin.getc)
if char == '%'
last_numbers = chars[-3..-1].reject { |c| c.match(/\d/).nil? }
current_percent = last_numbers.join.to_i
if current_percent < last_percent
current_percent = last_percent + current_percent
end
at current_percent, 100
last_percent = current_percent
chars = []
end
chars << char
end
end
end
end
@germs12
Copy link

germs12 commented May 29, 2013

Hi,

I believe i'm also experiencing a memory leak in SideKiq. Did you find a solution to this problem? Have you heard anything else or identified the source? I appreciate the help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment