* - Tag particural databases, where query must be sent.
* - Send the query.
* - Fetch the results.
- *
- * Fixme:
- * - should also loop over untagged connections, waiting for READ events?
- * that would allow to track conn status better.
*/
#include "plproxy.h"
/* how long ts been idle */
t = now->tv_sec - conn->query_time;
-#ifdef PLPROXY_IDLE_CONN_CHECK
if (t < PLPROXY_IDLE_CONN_CHECK)
-#else
- if (1)
-#endif
return true;
/*
- * There was a idea to call PQconsumeInput couple of times on a long-idle
- * connections, to see if they are still alive.
- *
- * As this is complicated, then ATM just do a select(,,,0) on fd.
- * Stable conn should have no events pending.
+ * Simple way to check if old connection is stable - look if there
+ * are events pending. If there are drop the connection.
*/
intr_loop:
fd = PQsocket(conn->db);
/*
* Check connections that are idle more than this many seconds.
- * Undefine to disable.
+ * Set 0 to always check.
*/
-#define PLPROXY_IDLE_CONN_CHECK 10
+#define PLPROXY_IDLE_CONN_CHECK 2
/* Flag indicating where function should be executed */
typedef enum RunOnType