sql: send cron in application_name to show origin of queries in PostgreSQL (#75795)
gitea/wcs/pipeline/head This commit looks good
Details
gitea/wcs/pipeline/head This commit looks good
Details
This commit is contained in:
parent
42b4108781
commit
1626ad4e1a
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue