Преглед изворни кода

[Minor] Ensure that Redis inactive connections are well maintained

tags/3.1
Vsevolod Stakhov пре 2 година
родитељ
комит
7721a1a19b
1 измењених фајлова са 4 додато и 1 уклоњено
  1. 4
    1
      src/libserver/redis_pool.cxx

+ 4
- 1
src/libserver/redis_pool.cxx Прегледај датотеку

ctx, real_timeout); ctx, real_timeout);


timeout.data = this; timeout.data = this;
/* Restore in case if these fields have been modified externally */
ctx->data = this;
redisAsyncSetDisconnectCallback(ctx, redis_pool_connection::redis_on_disconnect);
ev_timer_init(&timeout, ev_timer_init(&timeout,
redis_pool_connection::redis_conn_timeout_cb, redis_pool_connection::redis_conn_timeout_cb,
real_timeout, real_timeout / 2.0); real_timeout, real_timeout / 2.0);
else { else {
if (how == RSPAMD_REDIS_RELEASE_DEFAULT) { if (how == RSPAMD_REDIS_RELEASE_DEFAULT) {
/* Ensure that there are no callbacks attached to this conn */ /* Ensure that there are no callbacks attached to this conn */
if (ctx->replies.head == nullptr) {
if (ctx->replies.head == nullptr && (ctx->c.flags & REDIS_CONNECTED)) {
/* Just move it to the inactive queue */ /* Just move it to the inactive queue */
conn->state = rspamd_redis_pool_connection_state::RSPAMD_REDIS_POOL_CONN_INACTIVE; conn->state = rspamd_redis_pool_connection_state::RSPAMD_REDIS_POOL_CONN_INACTIVE;
conn->elt->move_to_inactive(conn); conn->elt->move_to_inactive(conn);

Loading…
Откажи
Сачувај