Reputation: 6238
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)?
Upvotes: 5
Views: 3785
Reputation: 4754
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:
Upvotes: 9