# Why does broadcast\_refresh need to be in a background job?

**URL:** https://discuss.hotwired.dev/t/why-does-broadcast-refresh-need-to-be-in-a-background-job/6224
**Category:** General
**Created:** [February 6, 2025, 4:12pm UTC](https://discuss.hotwired.dev/t/why-does-broadcast-refresh-need-to-be-in-a-background-job/6224 "2025-02-06T16:12:58Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jch](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/jch/32/3916_2.png) [@jch](https://discuss.hotwired.dev/u/jch)
#### Post date: [February 6, 2025, 4:12pm UTC](https://discuss.hotwired.dev/t/why-does-broadcast-refresh-need-to-be-in-a-background-job/6224/1 "2025-02-06T16:12:58Z")

</div>

From the source [turbo-rails/app/models/concerns/turbo/broadcastable.rb at main · hotwired/turbo-rails · GitHub](https://github.com/hotwired/turbo-rails/blob/main/app/models/concerns/turbo/broadcastable.rb#L386)

```ruby
# As a rule, you should use the <tt>_later</tt> versions of everything except for remove when broadcasting
# within a real-time path, like a controller or model, since all those updates require a rendering step, which can slow down
# execution. You don't need to do this for remove, since only the dom id for the model is used.

# ... snip
# Same as <tt>#broadcasts_refreshes_to</tt>, but the designated stream for page refreshes is automatically set to
# the current model, for creates - to the model plural name, which can be overriden by passing <tt>stream</tt>.
def broadcasts_refreshes(stream = model_name.plural)
  after_create_commit -> { broadcast_refresh_later_to(stream) }
  after_update_commit -> { broadcast_refresh_later }
  after_destroy_commit -> { broadcast_refresh }
end

```

Why is an update commit queued in a background job, but the destroy commit done inline? The comment suggests that `later` should be used for anything blocking requiring rendering, but the refresh turbo stream tag doesn’t require any rendering:

```html
<turbo-stream action="refresh"></turbo-stream>

```

---

<div class="post-metadata">

### Author: ![defsdoor](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/defsdoor/32/2135_2.png) [@defsdoor](https://discuss.hotwired.dev/u/defsdoor)
#### Post date: [February 10, 2025, 9:06am UTC](https://discuss.hotwired.dev/t/why-does-broadcast-refresh-need-to-be-in-a-background-job/6224/2 "2025-02-10T09:06:16Z")

</div>

Could be because it’s not around later - as it’s just been destroyed ?
