mirror of
https://github.com/ansible/awx.git
synced 2026-02-23 22:16:00 -03:30
Merge pull request #8436 from jbradberry/profile-sql-message
Improve handling of 0 and negative thresholds in the profile_sql command Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
@@ -19,7 +19,9 @@ class Command(BaseCommand):
|
|||||||
profile_sql.delay(
|
profile_sql.delay(
|
||||||
threshold=options['threshold'], minutes=options['minutes']
|
threshold=options['threshold'], minutes=options['minutes']
|
||||||
)
|
)
|
||||||
print(f"Logging initiated with a threshold of {options['threshold']} second(s) and a duration of"
|
if options['threshold'] > 0:
|
||||||
f" {options['minutes']} minute(s), any queries that meet criteria can"
|
print(f"SQL profiling initiated with a threshold of {options['threshold']} second(s) and a"
|
||||||
f" be found in /var/log/tower/profile/."
|
f" duration of {options['minutes']} minute(s), any queries that meet criteria can"
|
||||||
)
|
f" be found in /var/log/tower/profile/.")
|
||||||
|
else:
|
||||||
|
print("SQL profiling disabled.")
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ def delete_project_files(project_path):
|
|||||||
|
|
||||||
@task(queue='tower_broadcast_all')
|
@task(queue='tower_broadcast_all')
|
||||||
def profile_sql(threshold=1, minutes=1):
|
def profile_sql(threshold=1, minutes=1):
|
||||||
if threshold == 0:
|
if threshold <= 0:
|
||||||
cache.delete('awx-profile-sql-threshold')
|
cache.delete('awx-profile-sql-threshold')
|
||||||
logger.error('SQL PROFILING DISABLED')
|
logger.error('SQL PROFILING DISABLED')
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user