diff options
author | J. Ryan Stinnett <jryans@gmail.com> | 2019-09-18 21:33:35 +0100 |
---|---|---|
committer | J. Ryan Stinnett <jryans@gmail.com> | 2019-09-18 21:33:35 +0100 |
commit | ef0281a97d904f8013bceeaa0b9fb2827bc4b9d1 (patch) | |
tree | 0e7305b73b8e4b8a303a697de51bb3d32c305c6e /synapse | |
parent | Fix logcontext spam on non-Linux platforms (diff) | |
download | synapse-jryans/logcontext-spam.tar.xz |
Use variable instead of function github/jryans/logcontext-spam jryans/logcontext-spam
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/logging/context.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/synapse/logging/context.py b/synapse/logging/context.py index 4bca44d4e1..370000e377 100644 --- a/synapse/logging/context.py +++ b/synapse/logging/context.py @@ -43,8 +43,7 @@ try: # exception. resource.getrusage(RUSAGE_THREAD) - def is_thread_resource_usage_supported(): - return True + is_thread_resource_usage_supported = True def get_thread_resource_usage(): return resource.getrusage(RUSAGE_THREAD) @@ -53,8 +52,7 @@ try: except Exception: # If the system doesn't support resource.getrusage(RUSAGE_THREAD) then we # won't track resource usage. - def is_thread_resource_usage_supported(): - return False + is_thread_resource_usage_supported = False def get_thread_resource_usage(): return None @@ -367,8 +365,10 @@ class LoggingContext(object): # When we stop, let's record the cpu used since we started if not self.usage_start: # Log a warning on platforms that support thread usage tracking - if is_thread_resource_usage_supported(): - logger.warning("Called stop on logcontext %s without calling start", self) + if is_thread_resource_usage_supported: + logger.warning( + "Called stop on logcontext %s without calling start", self + ) return utime_delta, stime_delta = self._get_cputime() |