class CheckBatch
Public Class Methods
new(id, host='localhost:4567')
click to toggle source
# File tools/multithread_batch.rb, line 4 def initialize id, host='localhost:4567' @id=id mycsv = CSV_MODULE::MyCSV.new('auxillary/testdata.csv') @queries = mycsv.get_queries @iterations = 400 @url = "http://#{host}/sentra/analyzer/batch" end
Public Instance Methods
call()
click to toggle source
# File tools/multithread_batch.rb, line 12 def call puts 'STARTED THREAD NUMBER: ' + @id.to_s r = Random.new batch_query = [] @iterations.times do |time| q = {} q['content'] = @queries[r.rand(0..490)]['content'] batch_query.push q end response = RestClient2.post(@url, batch_query.to_json) json = JSON.parse(response.body) p json end