We have a site setting called rebake old posts count that auto rebakes ‘X’ number of un-baked posts every 15 minutes. You can set individual posts for a background rebake like this:
-
mark a single post for rebake
Post.where(id: 1234).update_all('baked_version = NULL') -
mark all posts for rebake
Post.update_all("baked_version = NULL") -
mark all posts in a topic for rebake
Post.where(topic_id: 1234).update_all('baked_version = NULL') -
mark all posts in a category for rebake
Post.joins(:topic).where('topics.category_id = 1234').update_all('baked_version = NULL')
Running this command will simply mark the post(s) for a background rebake through the PeriodicalUpdates job that runs every 15 minutes. You could also increase the value in the site setting for a less resource-intensive periodic rebake process.