Created
March 17, 2022 17:00
-
-
Save ollieh-m/168a807a74f90fe1ac201b412cf3c075 to your computer and use it in GitHub Desktop.
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
it "causes deadlock?", use_transactional_tests: false do | |
device = create(:device, push_notification_subscriptions: %w(cooksnap_reminder mentioned_in_comment moderation_message)) | |
threads = [] | |
threads << Thread.new do | |
puts "START THREAD 1" | |
DeviceCreationService.run( | |
device.user, { | |
access_token: device.access_token, | |
token: device.token, | |
platform: device.platform, | |
push_notification_subscriptions: ["tip_likers", "comment"] | |
} | |
) | |
end | |
threads << Thread.new do | |
puts "START THREAD 2" | |
sleep(0.07) | |
DeviceCreationService.run( | |
device.user, { | |
access_token: device.access_token, | |
token: device.token, | |
platform: device.platform, | |
push_notification_subscriptions: ["tip_likers", "comment"] | |
} | |
) | |
end | |
threads.each(&:join) | |
ensure | |
# Need to perform manual clean up since transactional tests are disabled | |
User.destroy_all | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment