Not working with dynamic urls
KranthiKishore opened this issue · 10 comments
Hi,
I'm trying to generate an image from a dynamic url which comes in parameters
Parameters: {"share_url"=>"http://localhost:3000//share?id=Ym1jLTk0"}
and in my code am doing Gastly.capture(params[:share_url], "destination.png")
But its taking lot of time. When I try the same in rails console, its generating image in couple of seconds.
Could you please tell me the solution?
Hi, @KranthiKishore. You use WEBrick as an application server?
@mgrachev Yes.
@KranthiKishore You need to use the multi-threaded server, such as a Puma.
@mgrachev you mean I have to start puma server with multiple threads? Because I used puma gem but that too doesn't work
@KranthiKishore What server starts with the command rails server
?
To start the Puma server, run the command: bundle exec rails s puma
@mgrachev I have tried the same but its taking longer time to generate images. Infact not generating.
my controller code looks like
def download
screeenshot = Gastly.capture(params[:share_url], 'test.png')
end
But don't see any image(test.png) generated in rails root directory. Can you tell me what might be the problem?
@KranthiKishore I created a test project on Ruby on Rails 4.2.7 - https://github.com/mgrachev/gastly_test_project. Everything works, screenshots generated.
@KranthiKishore If app is running on dev environment and your share_url points to the same server, you need to enable the concurrency by setting config.allow_concurrency = true
Thanks @stalin it worked 👍 😄