# Rebake and Oneboxes confusion

**URL:** https://meta.discourse.org/t/rebake-and-oneboxes-confusion/248167
**Category:** Support
**Tags:** rails-console
**Created:** [December 7, 2022, 2:55pm UTC](https://meta.discourse.org/t/rebake-and-oneboxes-confusion/248167 "2022-12-07T14:55:26Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![rahim123](https://avatars.discourse-cdn.com/v4/letter/r/df705f/32.png) [@rahim123](https://meta.discourse.org/u/rahim123)
#### Post date: [December 7, 2022, 2:55pm UTC](https://meta.discourse.org/t/rebake-and-oneboxes-confusion/248167/1 "2022-12-07T14:55:26Z")

</div>

Hi there, on my testbed migration from Drupal I ran a bunch of `regexp_replace` commands from the Postegres console, requiring a rebake of all the posts. So for the past \>12 hours I have `rake posts:rebake` still crunching through almost 2M posts. I checked out one of the topics that already got rebaked and I noticed that Oneboxes aren’t displaying unless I manually edit the post ( **Rebuild HTML** doesn’t help). So if I understand correctly it appears that I’m going to have to spend another 20 hours to run `rake posts:refresh_oneboxes` ? That command also echoes: `Rebaking post markdown for 'default'"` , which makes me think that I could have killed two birds with one stone by initially running just `refresh_oneboxes` to refresh the Oneboxes and also rebuild the post HTML after the regexp replacements?

It looks like I could alternatively run this in `rails c` :

```plaintext
Post.find_each do |p|
    p.rebake!(invalidate_oneboxes: true)
    p.save ###Needed?
end

```

Would that be any faster than the `rake` command?

Also, while on this subject I’d like to understand when I also need to use `p.save` in the Rails console, would it be needed for the above process?

Thanks a lot!

---

<div class="post-metadata">

### Author: ![crcoli7307](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/crcoli7307/32/267901_2.png) [@crcoli7307](https://meta.discourse.org/u/crcoli7307)
#### Post date: [December 11, 2022, 7:51pm UTC](https://meta.discourse.org/t/rebake-and-oneboxes-confusion/248167/2 "2022-12-11T19:51:26Z")

</div>

Sorry about the lack of replies as you probably already have the posts rebaked, but for future reference:

I think that `rake posts:rebake` would be the fastest way and is less prone to erroring. To make the rebaking go faster, I would recommend giving the forum more resources (specifically Memory capacity and CPU cores) so that it can crank through the posts faster. Rebaking is only limited by the resources the machine has.

---

<div class="post-metadata">

### Author: ![rahim123](https://avatars.discourse-cdn.com/v4/letter/r/df705f/32.png) [@rahim123](https://meta.discourse.org/u/rahim123)
#### Post date: [December 12, 2022, 1:57am UTC](https://meta.discourse.org/t/rebake-and-oneboxes-confusion/248167/3 "2022-12-12T01:57:18Z")

</div>

Excellent, many thanks for confirming that!

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [January 11, 2023, 1:58am UTC](https://meta.discourse.org/t/rebake-and-oneboxes-confusion/248167/4 "2023-01-11T01:58:00Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
