I hope this question is clear enough -- if not let me know :)
What API would I use when I want to write a procedure at runtime and then just run it eventually at low priority while continuing to do the important stuff right no开发者_如何学Cw?
Example: link checker
1. I write a blog post with links represented by Link objects. I publish the post. 2. Eventually (at very low priority) the system gets around to fetching the URL of each Link object to make sure it's not broken and indicates that in a property of the Link object. 3. When a user visits my blog post, the render code that turns Link objects into HTML knows whether the links have been checked.I'm assuming there's a very general purpose API for doing this kind of "eventually/low priority" stuff.
Delayed Job is great for queuing tasks in Rails apps.
I think you'd generally do this kind of stuff with a cronjob or your system's equivalent functionality. Have a script that goes through all the links in your database and check whether they're valid. Maybe have an hourly one that does it for new links and have the others set to daily or weekly so you're not doing too much work.
精彩评论