-
Notifications
You must be signed in to change notification settings - Fork 106
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
link_thumbnailer takes too much time to load #57
Comments
Please give me an URL as an example. Otherwise I won't be able to help you |
it is on localhost i am developing a rails app |
where is your code base for the demo app .... |
here is my code in the view file
i am taking @post from the model and generating the thumbnail from the url in @post . |
Sounds great but give me an example of a URL to scrap :) Here is the demo https://github.com/gottfrois/link_thumbnailer_demo |
@gottfrois yes, it is little bit slow. I tried this. It took time to load 15.31 seconds. |
@MihirKumarThakur Source code is added to the Readme file. |
It seems to be pretty slow due to image stats. You can disable them if you don't care about image size and type but only care about the URLs: LinkThumbnailer.generate('https://pragprog.com/book/mskanban/real-world-kanban', image_stats: false) Also the |
@gottfrois Yes, tried with |
Hum yes it's because the gem is not able to sort the images based on their size anymore. So the images returned are in order of appearance on the page to scrap |
@gottfrois I'll try to look into the code. let's see If i can add any value there or not.. :) |
Feel free to do so but unfortunately I don't see a way around this. Image size are gathered over http requests which is what makes it slow. By passing this, it reduce drastically the scraping time but then you can't compare images by size anymore :( A not easy to implement solution would be to fetch images size in parallel using typhoeus gem for example in order to make concurrent HTTP requests instead of one by one. |
@gottfrois +1 |
Just to let you know guys, I am working on a solution for this. Stay tune |
I replaced FastImage gem by my own version called ImageInfo that allow to fetch images concurrently. My own benchmark shows a page that used to take about ~4.5 second to load now takes less than a second. The fix is available now in Can you guys try in out and let me know if it improve your use cases? Thx |
@gottfrois I have updated my Gem. For some links it is hanging, and not giving any result. Started GET "/posts/link_thumbnailer?url=http%3A%2F%2Fwww.nolo.com%2Flegal-encyclopedia%2Fdivorce-do-you-need-lawyer-29502.html" for 127.0.0.1 at 2015-08-12 12:27:20 +0530
Processing by PostsController#link_thumbnailer as */*
Parameters: {"url"=>"http://www.nolo.com/legal-encyclopedia/divorce-do-you-need-lawyer-29502.html"}
Account Load (0.5ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."deleted_at" IS NULL AND "accounts"."id" = $1 ORDER BY "accounts"."id" ASC LIMIT 1 [["id", 2]]
ETHON: Libcurl initialized
ETHON: started MULTI |
Thanks, i will take a look. Can you please create a new issue for this one? |
@gottfrois Sure, I will. |
It takes too much time to load and some times gives the timeout error.
The text was updated successfully, but these errors were encountered: