File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 711
711
lock . lock do
712
712
lock . exists? . should . be . true
713
713
REDIS_HANDLE . exists? ( "test_lock0" ) . should . be . true
714
- sleep 0.3 # hand onto the lock
714
+ sleep 1.0 # hang onto the lock across other thread
715
715
end
716
716
end
717
717
735
735
lock . lock do
736
736
lock . exists? . should . be . true
737
737
REDIS_HANDLE . exists? ( "test_lock1" ) . should . be . true
738
- sleep 0.3 # hang onto the lock > expiry
738
+ sleep 1.0 # hang onto the lock > expiry
739
739
end
740
740
741
741
# lock value should not be set since the lock was held for more than the expiry
749
749
750
750
lock . lock do
751
751
REDIS_HANDLE . exists? ( "test_lock2" ) . should . be . true
752
- sleep 0.3 # expired, key is deleted
752
+ sleep 1.0 # expired, key is deleted
753
753
REDIS_HANDLE . exists? ( "test_lock2" ) . should . be . false
754
754
REDIS_HANDLE . set ( "test_lock2" , "foo" ) # this is no longer a lock key, name is a coincidence
755
755
end
758
758
end
759
759
760
760
it "should manually delete the key if finished before expiration" do
761
- lock = Redis ::Lock . new ( :test_lock3 , :expiration => 1 .0)
761
+ lock = Redis ::Lock . new ( :test_lock3 , :expiration => 10 .0)
762
762
763
763
lock . lock do
764
764
REDIS_HANDLE . exists? ( "test_lock3" ) . should . be . true
You can’t perform that action at this time.
0 commit comments