not working with url source referring to application
--following is what i'm trying to do......
filename = current_user.slug + "-" + Time.now.to_i.to_s kit = IMGKit.new("http://127.0.0.1:3000/snapshot/#{current_user.slug}") img = kit.to_img(:png) temp_dir = Rails.root.join('tmp') Dir.mkdir(temp_dir) unless Dir.exists?(temp_dir) file = Tempfile.new([filename, 'png'], temp_dir, :encoding => 'ascii-8bit') file.write(img) file.flush current_user.shares.create!(share_type: "image", snap: file) file.unlink
--when the url source is "http://127.0.0.1:3000" or my staging app url "http://recroup-stage.herokuapp.com/ " it goes into an endless loop...
--when i do the same thing in rails console it works but not in the app
--please let me know what i'm doing wrong here..
Are you using webrick server? It can serve only 1 request...
Try using unicorn server with 2 or more workers
You should consider putting this in something like a resque job, that's what I did and it seem to work fine.