mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-12-04 04:49:08 +08:00
Merge branch 'gitee-master' into gitlab-upstream
This commit is contained in:
commit
e06eb8d5f5
@ -513,7 +513,7 @@ void connect_manager::keep_min_conns(const std::vector<connect_pool*>& pools,
|
||||
|
||||
void connect_manager::pools_dump(size_t step, std::vector<connect_pool*>& out)
|
||||
{
|
||||
size_t pools_size, check_max, check_pos;
|
||||
size_t pools_size;
|
||||
unsigned long id = get_id();
|
||||
|
||||
lock_.lock();
|
||||
@ -529,12 +529,10 @@ void connect_manager::pools_dump(size_t step, std::vector<connect_pool*>& out)
|
||||
step = pools_size;
|
||||
}
|
||||
|
||||
check_pos = pools.check_next++ % pools_size;
|
||||
check_max = check_pos + step;
|
||||
|
||||
while (check_pos < pools_size && check_pos < check_max) {
|
||||
connect_pool* pool = pools.pools[check_pos++ % pools_size];
|
||||
pool->refer(); // Increase reference to avoid freed.
|
||||
for (size_t i = 0; i < step; i++) {
|
||||
connect_pool* pool = pools.pools[pools.check_next % pools_size];
|
||||
pools.check_next++;
|
||||
pool->refer();
|
||||
out.push_back(pool);
|
||||
}
|
||||
|
||||
|
@ -524,7 +524,6 @@ size_t connect_pool::check_dead(size_t count)
|
||||
size_t connect_pool::check_dead(size_t count, thread_pool& threads)
|
||||
{
|
||||
// Check all connections in threads pool.
|
||||
|
||||
size_t n = 0;
|
||||
tbox<bool> box;
|
||||
std::vector<check_job*> jobs;
|
||||
@ -553,8 +552,8 @@ size_t connect_pool::check_dead(size_t count, thread_pool& threads)
|
||||
struct timeval end;
|
||||
gettimeofday(&end, NULL);
|
||||
double tc = stamp_sub(end, begin);
|
||||
logger("Threads: limit=%zd, count=%d; jobs count=%zd, %zd, time cost=%.2f ms",
|
||||
threads.get_limit(), threads.threads_count(), jobs.size(), count, tc);
|
||||
logger("Addr: %s; threads: limit=%zd, count=%d; jobs count=%zd, %zd, time cost=%.2f ms",
|
||||
addr_, threads.get_limit(), threads.threads_count(), jobs.size(), count, tc);
|
||||
|
||||
for (std::vector<check_job*>::iterator it = jobs.begin();
|
||||
it != jobs.end(); ++it) {
|
||||
@ -716,8 +715,8 @@ void connect_pool::keep_conns(size_t min, thread_pool& threads)
|
||||
struct timeval end;
|
||||
gettimeofday(&end, NULL);
|
||||
double tc = stamp_sub(end, begin);
|
||||
logger("Threads: limit=%zd, count=%d; jobs count=%zd, time cost=%.2f ms",
|
||||
threads.get_limit(), threads.threads_count(), jobs.size(), tc);
|
||||
logger("Addr=%s; threads: limit=%zd, count=%d; jobs count=%zd, time cost=%.2f ms",
|
||||
addr_, threads.get_limit(), threads.threads_count(), jobs.size(), tc);
|
||||
|
||||
for (std::vector<check_job*>::iterator it = jobs.begin();
|
||||
it != jobs.end(); ++it) {
|
||||
|
Loading…
Reference in New Issue
Block a user