File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -23,13 +23,10 @@ def initialize(model_class, options)
2323 :dependent => :nullify , # or :destroy or :delete_all -- see the README
2424 :name_column => 'name' ,
2525 :with_advisory_lock => true ,
26- :advisory_lock_timeout_seconds => nil ,
26+ :advisory_lock_timeout_seconds => 5 ,
2727 :numeric_order => false
2828 } . merge ( options )
2929 raise ArgumentError , "name_column can't be 'path'" if options [ :name_column ] == 'path'
30- if !options [ :with_advisory_lock ] && options [ :advisory_lock_timeout_seconds ] . present?
31- raise ArgumentError , "advisory_lock_timeout_seconds cannot be provided when advisory lock is disabled"
32- end
3330 if order_is_numeric?
3431 extend NumericOrderSupport . adapter_for_connection ( connection )
3532 end
Original file line number Diff line number Diff line change @@ -121,6 +121,12 @@ def work
121121 end
122122
123123 it 'fails to deadlock while simultaneously deleting items from the same hierarchy' do
124+ allow ( User ) . to receive ( :with_advisory_lock! ) . and_wrap_original do |method , *args , &block |
125+ options = args . extract_options!
126+ options [ :timeout_seconds ] = nil
127+ method . call ( *args , options , &block )
128+ end
129+
124130 target = User . find_or_create_by_path ( ( 1 ..200 ) . to_a . map { |ea | ea . to_s } )
125131 emails = target . self_and_ancestors . to_a . map ( &:email ) . shuffle
126132 Parallel . map ( emails , :in_threads => max_threads ) do |email |
You can’t perform that action at this time.
0 commit comments