mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 02:11:08 -06:00
d57b7abe67
After data seed, we should reset Redis cache to ensure that the correct flags are cached.
However, `db:create` is skipping Redis
https://github.com/discourse/discourse/blob/main/lib/tasks/db.rake#L39
And uses `ActiveSupport::Cache::MemoryStore.new`
e2292d4c59/lib/discourse.rb (L523)
Therefore, the reset flags cache was moved to initializers and evaluated only when the cache is Redis and Flags table already exists.
Meta: https://meta.discourse.org/t/development-install-fails-when-running-bin-rails-db-migrate/332754
9 lines
234 B
Ruby
9 lines
234 B
Ruby
# frozen_string_literal: true
|
|
|
|
# On initialize, reset flags cache
|
|
Rails.application.config.to_prepare do
|
|
if Discourse.cache.is_a?(Cache) && ActiveRecord::Base.connection.table_exists?(:flags)
|
|
Flag.reset_flag_settings!
|
|
end
|
|
end
|