[databases]
* = host=postgresql-server port=5432 user=mediacloud

[pgbouncer]

; Actual logging done to STDOUT
logfile = /dev/null

pidfile = /var/run/postgresql/pgbouncer.pid
listen_addr = 0.0.0.0
listen_port = 6432
unix_socket_dir = /var/run/postgresql

auth_type = md5
auth_file = /etc/pgbouncer/userlist.txt

pool_mode = session
server_reset_query = DISCARD ALL
max_client_conn = 600
default_pool_size = 600
log_connections = 0
log_disconnections = 0
stats_period = 600
server_login_retry = 1

# PyCharm doesn't work without this one:
# https://github.com/Athou/commafeed/issues/559
ignore_startup_parameters = extra_float_digits

[databases]
* = host=postgresql-server port=5432 user=mediacloud

[pgbouncer]

; Actual logging done to STDOUT
logfile = /dev/null

pidfile = /var/run/postgresql/pgbouncer.pid
listen_addr = 0.0.0.0
listen_port = 6432
unix_socket_dir = /var/run/postgresql

auth_type = md5
auth_file = /etc/pgbouncer/userlist.txt

pool_mode = session
server_reset_query = DISCARD ALL
max_client_conn = 600
default_pool_size = 600
log_connections = 0
log_disconnections = 0
stats_period = 600
server_login_retry = 1

# Don't let transactions idle around for more than 10 minutes to prevent buggy
# code from leading to transaction wraparound issues
idle_transaction_timeout = 600

# PyCharm doesn't work without this one:
# https://github.com/Athou/commafeed/issues/559
ignore_startup_parameters = extra_float_digits

Set idle_transaction_timeout to 10 minutes in PgBouncer
Set idle_transaction_timeout to 10 minutes in PgBouncer

If the client application is misconfigured / buggy and leaves the transaction open for a long period of time, the connection then ends up in an "idle in transaction" state, the snapshot before the transaction started has to be kept around indefinitely and thus the autovacuum breaks, making the database run at a risk of hitting the transaction ID wraparound.

With this in place, PgBouncer is supposed to kill off "idle in transaction" connections after 10 minutes, i.e. if the client doesn't get around to executing COMMIT / ROLLBACK in 10 minutes, it will get disconnected.
