MCPcopy Create free account
hub / github.com/ByConity/ByConity / waitServersToFinish

Function waitServersToFinish

programs/keeper/Keeper.cpp:97–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95{
96
97int waitServersToFinish(std::vector<DB::ProtocolServerAdapter> & servers, size_t seconds_to_wait)
98{
99 const int sleep_max_ms = 1000 * seconds_to_wait;
100 const int sleep_one_ms = 100;
101 int sleep_current_ms = 0;
102 int current_connections = 0;
103 for (;;)
104 {
105 current_connections = 0;
106
107 for (auto & server : servers)
108 {
109 server.stop();
110 current_connections += server.currentConnections();
111 }
112
113 if (!current_connections)
114 break;
115
116 sleep_current_ms += sleep_one_ms;
117 if (sleep_current_ms < sleep_max_ms)
118 std::this_thread::sleep_for(std::chrono::milliseconds(sleep_one_ms));
119 else
120 break;
121 }
122 return current_connections;
123}
124
125Poco::Net::SocketAddress makeSocketAddress(const std::string & host, UInt16 port, Poco::Logger * log)
126{

Callers 1

mainMethod · 0.70

Calls 2

stopMethod · 0.45
currentConnectionsMethod · 0.45

Tested by

no test coverage detected