From 52fef3c5fe29b3d69896529c5de8441243434f8a Mon Sep 17 00:00:00 2001 From: 17620729224 <52349503+17620729224@users.noreply.github.com> Date: Thu, 30 Apr 2020 17:32:55 +0800 Subject: [PATCH] Update memcache.py function get_slab_stats miss decode --- memcache.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/memcache.py b/memcache.py index 05b6657..d82e05e 100644 --- a/memcache.py +++ b/memcache.py @@ -349,10 +349,10 @@ def get_slab_stats(self): readline = s.readline while 1: line = readline() - if not line or line.strip() == 'END': + if not line or line.decode('ascii').strip() == 'END': break - item = line.split(' ', 2) - if line.startswith('STAT active_slabs') or line.startswith('STAT total_malloced'): + item = line.decode('ascii').split(' ', 2) + if line.decode('ascii').startswith('STAT active_slabs') or line.decode('ascii').startswith('STAT total_malloced'): serverData[item[1]] = item[2] else: # 0 = STAT, 1 = ITEM, 2 = Value @@ -380,9 +380,9 @@ def get_slabs(self): readline = s.readline while 1: line = readline() - if not line or line.strip() == 'END': + if not line or line.decode('ascii').strip() == 'END': break - item = line.split(' ', 2) + item = line.decode('ascii').split(' ', 2) # 0 = STAT, 1 = ITEM, 2 = Value slab = item[1].split(':', 2) # 0 = items, 1 = Slab #, 2 = Name