mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
PERF: Enqueue Job::BackfillBadge
in Jobs::BadgeGrant
(#30945)
This commit updates the `Jobs::BadgeGrant` scheduled job to enqueue on `Job::BackfillBadge` regular job for each enabled badge on the site. The rationale for this change is that we started seeing the `Jobs::BadgeGrant` job taking hours on sites with lots of enabled badges as well as users because the job was backfilling all enabled badges serially within the job. This is bad as it means that a `mini_scheduler` thread is tied up by this job thus reducing the overall capacity of `mini_scheduler` for hours.
This commit is contained in:

committed by
GitHub

parent
b195b1c8a6
commit
3e4eac0fed
@ -144,7 +144,7 @@ class UserBadgesController < ApplicationController
|
||||
UserBadge.where(user_id: user_badge.user_id, badge_id: user_badge.badge_id).update_all(
|
||||
is_favorite: !user_badge.is_favorite,
|
||||
)
|
||||
UserBadge.update_featured_ranks!(user_badge.user_id)
|
||||
UserBadge.update_featured_ranks!([user_badge.user_id])
|
||||
end
|
||||
|
||||
private
|
||||
|
Reference in New Issue
Block a user