I'm trying to get a progress bar going with delayed job
but I don't know how check the status of the object.
I have an object called Scrape
and it does some feed parsing or whatever so it takes about 30 seconds. What I cannot seem to do is find a way to access that object which has a progress integer attribute that keeps track of the parsing which I will call to make a simple %/css/div/ajax updater widget on the front side.
Can i use object_id
since the object doesn't have an id
until the process is complete/saved. If so how?
How an access this progress attribute on my object that is delayed. Or is there another wa开发者_运维百科y to do this?
You will need to use some other datastore that is shared between the two processes, that is kept up to date. Maybe a memcached key?
The delayed_job process updates that key and the web app has an AJAX-based background poller which hits an endpoint which in turn queries the same key, returning a status update back to the client.
精彩评论