From 3790fd252ce9c03579defa7d4ca3cb5695e94d02 Mon Sep 17 00:00:00 2001 From: Mislav Bradac Date: Tue, 12 Sep 2017 18:57:09 +0200 Subject: [PATCH] Change MAX_RETRIES in query_client Reviewers: florijan Reviewed By: florijan Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D785 --- tests/macro_benchmark/harness/clients/common.hpp | 6 ++++++ tests/macro_benchmark/harness/clients/query_client.cpp | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/macro_benchmark/harness/clients/common.hpp b/tests/macro_benchmark/harness/clients/common.hpp index 56aca1b71..8192cd5d2 100644 --- a/tests/macro_benchmark/harness/clients/common.hpp +++ b/tests/macro_benchmark/harness/clients/common.hpp @@ -1,5 +1,7 @@ +#include #include #include +#include #include #include "communication/bolt/client.hpp" @@ -56,12 +58,16 @@ communication::bolt::QueryData ExecuteNTimesTillSuccess( const std::map ¶ms, int times) { std::experimental::optional last_exception; + static thread_local std::mt19937 pseudo_rand_gen_{std::random_device{}()}; + static thread_local std::uniform_int_distribution<> rand_dist_{10, 50}; for (int i = 0; i < times; ++i) { try { auto ret = client.Execute(query, params); return ret; } catch (const utils::BasicException &e) { last_exception = e; + std::this_thread::sleep_for( + std::chrono::milliseconds(rand_dist_(pseudo_rand_gen_))); } } throw last_exception; diff --git a/tests/macro_benchmark/harness/clients/query_client.cpp b/tests/macro_benchmark/harness/clients/query_client.cpp index 941e559a9..534fcdc66 100644 --- a/tests/macro_benchmark/harness/clients/query_client.cpp +++ b/tests/macro_benchmark/harness/clients/query_client.cpp @@ -27,7 +27,7 @@ DEFINE_string(database, "", "Database for the database"); using communication::bolt::DecodedValue; -const int MAX_RETRIES = 1000; +const int MAX_RETRIES = 50; void PrintJsonMetadata( std::ostream &os,