I'd like to minimize the probability that we'll actually run the code
in the "messages not rendered yet in database" codepath since it might
perform poorly, and it seems like the best way to do that is to just
run a loop that renders them all.
(imported from commit 247cb85fffa6cbc95958b9feda97462792a542c2)