mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 18:26:29 +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. |
||
---|---|---|
.. | ||
activerecord_preventing_writes_spec.rb | ||
api_keys_spec.rb | ||
auto_reject_reviewable_users_spec.rb | ||
blocked_hotlinked_media_spec.rb | ||
category_tag_spec.rb | ||
content_security_policy_spec.rb | ||
discord_omniauth_spec.rb | ||
email_outbound_spec.rb | ||
email_style_spec.rb | ||
facebook_omniauth_spec.rb | ||
flags_spec.rb | ||
github_omniauth_spec.rb | ||
group_spec.rb | ||
invalid_request_spec.rb | ||
invite_only_registration_spec.rb | ||
message_bus_spec.rb | ||
multisite_cookies_spec.rb | ||
multisite_spec.rb | ||
rate_limiting_spec.rb | ||
request_tracker_spec.rb | ||
same_ip_spammers_spec.rb | ||
secure_uploads_spec.rb | ||
smtp_spec.rb | ||
spam_rules_spec.rb | ||
tag_counts_spec.rb | ||
topic_auto_close_spec.rb | ||
topic_thumbnail_spec.rb | ||
twitter_omniauth_spec.rb | ||
watched_words_spec.rb |