mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 01:34:13 +08:00
6bf0ac730f
Firstly, we need to understand that ActiveRecord can be connected to a role which prevent writes and this happens in Discourse when a replica database has been setup for failover purposes. When a role prevent writes from happening, ActiveRecord will raise the `ActiveRecord::ReadOnlyError` if a write query is attempted. Secondly, theme fields are baked at runtime within GET requests. The baking process involves writing the baked value to the `ThemeField#baked_value` column in the database. If we combine the two points above, we can see how the writing of the baked value to the database will trigger a `ActiveRecord::ReadOnlyError` in a GET requests when the database is connected to a role preventing writes. However, failing to bake a theme is not the end of the world and should not cause GET requests to fail. Therefore, this commit adds a rescue for `ActiveRecord::ReadOnlyError` in the `ThemeField#ensure_baked!` method. |
||
---|---|---|
.. | ||
defer.rb |