Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私は理解できない。sidekiq または resque ワーカータスクの結果を取得するには? 例えば:
class HardWorker include Sidekiq::Worker def perform(a, b) a+b end end HardWorker.perform_async(10,10)
結果を取得する方法は?
データベースやファイル システム (または amazon の S3) など、ワーカーとシステムの残りの部分との間で共有されるシステム リソースを変更することによって結果を取得します。
これは非同期操作であるため、実行メソッド内でシステムを更新する (データベース行などを更新する) か、カスタム コールバック ブロックまたは関数を渡すことができます。非同期性を忘れないでください。別のスレッドで作業しています。