1234567891011121314151617181920212223242526272829 |
- class AvatarCreateJob < ApplicationJob
- include HasActiveJobLock
- low_priority
- retry_on StandardError, attempts: 20, wait: lambda { |executions|
- executions * 10.seconds
- }
- def lock_key
-
- "#{self.class.name}/User/
- end
- def perform(user)
- avatar = Avatar.auto_detection(
- object: 'User',
- o_id: user.id,
- url: user.email
- )
-
- return if !avatar
- user.update! image: avatar.store_hash
- end
- end
|