6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/usage_credits/jobs/fulfillment_job.rb', line 6
def perform
Rails.logger.info "Starting credit fulfillment processing"
start_time = Time.current
count = FulfillmentService.process_pending_fulfillments
elapsed = Time.current - start_time
formatted_time = if elapsed >= 60
"#{(elapsed / 60).floor}m #{(elapsed % 60).round}s"
else
"#{elapsed.round(2)}s"
end
Rails.logger.info "Completed processing #{count} fulfillments in #{formatted_time}"
rescue StandardError => e
Rails.logger.error "Error processing credit fulfillments: #{e.message}"
raise
end
|