FIX: ensure we only ever enqueue 1 UpdateGravatar job

This commit is contained in:
Régis Hanol 2016-04-18 12:44:09 +02:00
parent fad017d842
commit 868e70e817

View file

@ -753,7 +753,8 @@ class User < ActiveRecord::Base
avatar = user_avatar || create_user_avatar
if SiteSetting.automatically_download_gravatars? && !avatar.last_gravatar_download_attempt
Jobs.enqueue(:update_gravatar, user_id: self.id, avatar_id: avatar.id)
Jobs.cancel_scheduled_job(:update_gravatar, user_id: self.id, avatar_id: avatar.id)
Jobs.enqueue_in(1.second, :update_gravatar, user_id: self.id, avatar_id: avatar.id)
end
# mark all the user's quoted posts as "needing a rebake"