1class BackfillSignatureUuidsJob < ApplicationJob |
|
2 queue_as :low_priority |
|
|
4 def perform(id = 0) |
5 signatures = Signature.where(uuid: nil).batch(id).to_a |
|
6 max_id = signatures.map(&:id).max |
|
8 signatures.each do |signature| |
|
9 next if signature.uuid? |
|
11 if signature.email? |
|
12 signature.update_uuid
|
|
13 end |
|
14 end |
|
16 if Signature.exists?(uuid: nil) |
|
17 self.class.perform_later(max_id) |
|
18 end |
|
19 end |
|
20end |