Why multiple Queries do not wait for all the results in response


#1

I have multiple queries in my rest request but it returns empty if I do not make the thread sleep for some millisecond, why is that? Also if I have many multiple queries it does not work with 300 ms. It means I have to increase the thread sleep time. I am using BlockingQueue to add the query result.

this.influxDbContext.getInfluxDB().query(query, chunkSize, new Consumer<QueryResult>() {
            @Override
            public void accept(QueryResult result) {
                queue.add(result);
            }});
        Thread.sleep(300);