Best way to monitor for completion of a Sidekiq job?

后端 未结 2 411
迷失自我
迷失自我 2021-02-02 13:05

I\'m using a Sidekiq worker to complete some requests to Facebook after a user signs-in for the first time. Typically the task takes around 20 seconds or so.

I\'d like

2条回答
  •  无人共我
    2021-02-02 13:48

    Paul, I would keep your concerns separated. I am assuming that the sidekiq worker uses some rails activerecord model to send some information to facebook. I would set a flag on that model to true when the facebook requests are completed successfully.

    Then you can have a setTimeout on in js to poll for that change in the db... or for faster, more automatic responses you can look into using web sockets. I have used a library called Pusher in the past. It's pretty easy to integrate with rails and makes for a very snappy UI.

提交回复
热议问题