[FIX] support psutils >= 4.0

This commit is contained in:
Stephen Medina 2016-03-23 13:57:39 -07:00 committed by Harald Welte
parent 447d3ec46e
commit 36ecb63f2c
1 changed files with 2 additions and 1 deletions

View File

@ -47,7 +47,8 @@ SLEEP_INTERVAL = 60 # 1 min
def memory_info(process):
""" psutil < 2.0 does not have memory_info, >= 3.0 does not have
get_memory_info """
return (getattr(process, 'memory_info', None) or process.get_memory_info)()
pmem = (getattr(process, 'memory_info', None) or process.get_memory_info)()
return (pmem.rss, pmem.vms)
#----------------------------------------------------------
# Werkzeug WSGI servers patched