X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=test%2Flib%2FCluster.cpp;h=3ecc6e9abea2d629009e3a54cf05e610bdef2e7c;hb=5a18a901fcfc7b5bef004eb9110a2386fe87224a;hp=4fcdb47bcbc358e94664f4dc3fe07fc19706dbbd;hpb=21e20f73898b5f47e6cbd866beb95e95d6bf1215;p=awesomized%2Flibmemcached diff --git a/test/lib/Cluster.cpp b/test/lib/Cluster.cpp index 4fcdb47b..3ecc6e9a 100644 --- a/test/lib/Cluster.cpp +++ b/test/lib/Cluster.cpp @@ -7,9 +7,6 @@ Cluster::Cluster(Server serv, uint16_t cnt) : count{cnt} , proto{move(serv)} { - if (count < 4) { - count = stoi(getenv_else("MEMCACHED_CLUSTER", "4")); - } if (!count) { count = 1; } @@ -18,13 +15,6 @@ Cluster::Cluster(Server serv, uint16_t cnt) } } -Cluster::Cluster(vector servers) -: count{servers.size()} -, cluster{move(servers)} -{ - -} - Cluster::~Cluster() { stop(); wait(); @@ -46,11 +36,15 @@ bool Cluster::start() { return started; } -void Cluster::stop() { +void Cluster::stop(bool graceful) { for (auto &server : cluster) { server.drain(); - // no cookies for memcached; TERM is just too slow - server.signal(SIGKILL); + if (graceful) { + server.stop(); + } else { + // no cookies for memcached; TERM is just too slow + server.signal(SIGKILL); + } } }