I use Sidekiq to run a method delayed in controller (meanwhile I use Redis to update a progress bar). This method call a server, retrieve the data, do some manipulation and calculation; then can take a while.
For example, I have this method:
data_and_status = MyModelName.delay.retrieve_data(params[:tags], "preview", current_user, params[:from], params[:to])
This method should return the data manipulated, but doing in this manner data_and_status
is an hash (I guess that is the Sidekiq-job-id).
The data returned is very large, doing some caching with Redis is unfortunately out of question.
How can I retrieve a return value
of a delayed job (method)?
You say that the data returned (from your asynchronous job) is very large, and relaying it via Redis is out of the question. Well, your sidekiq job runs in a different process, possibly even on a different server, so you must find some inter-process way to transfer the data - if not your message queue (Redis), then the database.
For example:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With