WIP: sql: send cron in application_name to show origin of queries in PostgreSQL (#75795) #200

Closed
pducroquet wants to merge 1 commits from wip/75795-sql-application_name into main
2 changed files with 2 additions and 1 deletions

View File

@ -91,6 +91,7 @@ class Command(BaseCommand):
if verbosity > 1:
print('cron ignored on %s because it has no PostgreSQL configuration' % hostname)
continue
publisher.cfg["postgresql"]["application_name"] = "cron"
if domain:
cron_status, timestamp = 'ignored', now()
else:

View File

@ -568,7 +568,7 @@ def get_connection(new=False):
if not getattr(get_publisher(), 'pgconn', None):
postgresql_cfg = {}
for param in ('database', 'user', 'password', 'host', 'port'):
for param in ('database', 'user', 'password', 'host', 'port', 'application_name'):
value = get_cfg('postgresql', {}).get(param)
if value:
postgresql_cfg[param] = value