lib/peatio/bench/matching/amqp.rb
# TODO: Find better solution for getting message number in queue.
# E.g there is rabbitmqctl list_queues.
Find better solution for getting message number in queue.
E.g there is rabbitmqctl list_queues.
Find better solution for getting message number in queue . E . g there is rabbitmqctl list_queues .
def wait_for_matching
        last_log_time = Time.at(0)
        queue_status_file = File.open(queue_status_file_path('matching'), 'a')
        loop do
          queue_status = matching_queue_status
          break if queue_status[:messages].zero? &&
                  queue_status[:idle_since].present? &&
                  Time.parse("#{queue_status[:idle_since]} UTC") >= @publish_started_at
          if last_log_time + 5 < Time.now
            queue_status_file.puts(YAML.dump([queue_status.merge(timestamp: Time.now.iso8601).deep_stringify_keys]))
            last_log_time = Time.now
          end
          sleep 0.5
        end
      end
def wait_for_matching last_log_time = Time . at ( 0 ) queue_status_file = File . open ( queue_status_file_path ( 'matching' ) , 'a' ) loop do queue_status = matching_queue_status break if queue_status [ :messages ] . zero? && queue_status [ :idle_since ] . present? && Time . parse ( "#{queue_status[:idle_since]} UTC" ) >= @publish_started_at if last_log_time + 5 < Time . now queue_status_file . puts ( YAML . dump ( [ queue_status . merge ( timestamp : Time . now . iso8601 ) . deep_stringify_keys ] ) ) last_log_time = Time . now end sleep 0.5 end end
TODO: Find better solution for getting message number in queue.
TODO : Find better solution for getting message number in queue .