开发者

Rails Delayed Job Accessing value of background job

In my rails app, i have a timer 开发者_Python百科ticking every second based on which different objects change their state. Thus, i decided to use Observer for this. However, when i ran the observer, i noticed it hung up my entire app until the timer completed. Thus, i was thinking of keeping the timer as a background job using delayed_job.

Now my query is that is there any way to fetch the value of the timer every second and use it for some operations in the controller? Example, if i had a set of images appearing at different times, i would ideally like to fetch this current time from the timer and if timing of the image and the current time matches, the images change. Hence, is it possible to fetch the value like this every second from the background process? If yes, can anyone please elaborate?


Just make your delayed job background process save the timer value and corresponding image link to a table. Then read in that value in your controller and act accordingly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜