/* if last connect failed, there should be delay before next */
usec_t last_connect_time;
unsigned last_connect_failed:1;
+ unsigned last_login_failed:1;
unsigned welcome_msg_ready:1;
};
int cnt;
PgPool *pool = client->pool;
- /* reject if no servers and last connect failed */
- if (!pool->last_connect_failed)
+ /* reject if no servers are available and the last login failed */
+ if (!pool->last_login_failed)
return true;
cnt = pool_server_count(pool) - statlist_count(&pool->new_server_list);
if (cnt)
case SV_TESTED:
break;
case SV_LOGIN:
+ pool->last_login_failed = 0;
pool->last_connect_failed = 0;
break;
default:
* except when sending cancel packet
*/
if (!server->ready)
+ {
+ pool->last_login_failed = 1;
pool->last_connect_failed = 1;
+ }
else
+ {
+ /*
+ * We did manage to connect and used the connection for query
+ * cancellation, so to the best of our knowledge we can connect to
+ * the server, reset last_connect_failed accordingly.
+ */
+ pool->last_connect_failed = 0;
send_term = 0;
+ }
break;
default:
fatal("disconnect_server: bad server state (%d)", server->state);