Created
April 12, 2025 10:00
-
-
Save pmatsinopoulos/e40e2265cbfa65f4b20c577310c604a6 to your computer and use it in GitHub Desktop.
5 Sidekiq Jobs Using #increment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user = User.find_by!(email: "[email protected]") | |
puts "Initial user_balance: #{user.user_balance.balance}" | |
5.times do | |
CalculateUserBalanceJob.perform_later(user.id) | |
end | |
sleep(60) # just wait for the background job to finish. This is long enough | |
# for all the 5 Sidekiq jobs to finish | |
user.reload | |
puts "user_balance: #{user.user_balance.balance}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment