mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-05 07:13:12 +08:00
In a large forum with millions of users and millions of user_fields updating the list of dropdown user field options will result in a 502 now due to the large number of fields. This commit moves the indexing into a job.
10 lines
279 B
Ruby
10 lines
279 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Jobs::IndexUserFieldsForSearch < Jobs::Base
|
|
def execute(args)
|
|
user_field_id = args[:user_field_id]
|
|
SearchIndexer.queue_users_reindex(
|
|
UserCustomField.where(name: "user_field_#{user_field_id}").pluck(:user_id),
|
|
)
|
|
end
|
|
end
|