Open GesJeremie opened 5 years ago
Thanks for the issue @GesJeremie.
I'm reticent to add another lib just for this one use case, but 2 options come to mind for parallelizing:
ConcurrentRuby is a dependency of ActiveSupprt. There's already a CachedThreadPool available as Concurrent.global_io_executor, although a FixedThreadPool might be a better fit to throttle the number of active requests.
Is your feature request related to a problem? Please describe. I'm currently running the rake task workarea:cache:prime_images on few thousands products and I'm frustrated of how slow it is.
Describe the solution you'd like The current written code (workarea-core-3.4.16) is the following one:
It's basically a loop requesting a url through curl, wait for the result and go to the next record. The obvious optimization would be to run the curl requests in parallel.
In my side projects I usually use https://github.com/typhoeus/typhoeus and his Hydra "engine" but I'm pretty sure we can come up with some bash magic and call it a day.