mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 07:11:34 +08:00
FIX: Move user reindexing into a job (#26753)
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.
This commit is contained in:
@ -30,4 +30,14 @@ RSpec.describe UserField do
|
||||
|
||||
expect(user_field.description).to eq(link)
|
||||
end
|
||||
|
||||
it "enqueues index user fields job on save" do
|
||||
user_field = Fabricate(:user_field)
|
||||
|
||||
user_field.update!(description: "tomtom")
|
||||
|
||||
expect(
|
||||
job_enqueued?(job: Jobs::IndexUserFieldsForSearch, args: { user_field_id: user_field.id }),
|
||||
).to eq(true)
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user