Skip to content

Instantly share code, notes, and snippets.

@pmatsinopoulos
Last active April 12, 2025 15:48
Show Gist options
  • Save pmatsinopoulos/a11a2ab5887629a1a600be54c1e75c36 to your computer and use it in GitHub Desktop.
Save pmatsinopoulos/a11a2ab5887629a1a600be54c1e75c36 to your computer and use it in GitHub Desktop.
class CreateUserJob < ApplicationJob
queue_as :default
def perform(user_email)
puts "************** #{provider_job_id} About to create user: #{user_email}"
found = User.find_by(email: user_email)
return if found
sleep rand(5..10) # simulate some complex business logic to build the User object properly
User.create!(email: user_email)
puts "................ #{provider_job_id} FINISHED #{provider_job_id}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment