Sha256: 26a0dce2bbd744ab5f856c7de3f049dcd1b98c0a74e654609e6217a55690fae1

Contents?: true

Size: 339 Bytes

Versions: 10

Compression:

Stored size: 339 Bytes

Contents

module WaitForPop
  # This is trying to work around race conditions in a semi-sane manner
  def wait_for_pop
    queue = ActiveRecord::SqlAnalyzer.background_processor.instance_variable_get(:@queue)

    4.times do
      return sleep 0.1 if queue.empty?
      sleep 0.05
    end

    raise "Queue failed to drain in 0.2 seconds"
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
active_record-sql_analyzer-0.3.0 spec/support/wait_for_pop.rb
active_record-sql_analyzer-0.2.3 spec/support/wait_for_pop.rb
active_record-sql_analyzer-0.2.2 spec/support/wait_for_pop.rb
active_record-sql_analyzer-0.2.1 spec/support/wait_for_pop.rb
active_record-sql_analyzer-0.2.0 spec/support/wait_for_pop.rb
active_record-sql_analyzer-0.1.0 spec/support/wait_for_pop.rb
active_record-sql_analyzer-0.0.8 spec/support/wait_for_pop.rb
active_record-sql_analyzer-0.0.7 spec/support/wait_for_pop.rb
active_record-sql_analyzer-0.0.6 spec/support/wait_for_pop.rb
active_record-sql_analyzer-0.0.5 spec/support/wait_for_pop.rb