58 lines
2.0 KiB
Diff
58 lines
2.0 KiB
Diff
|
|
From f5e4d4f39cee3d3489242387409af0de917fb84c Mon Sep 17 00:00:00 2001
|
||
|
|
From: Sean Reifschneider <sean@realgo.com>
|
||
|
|
Date: Sat, 15 Apr 2023 14:45:18 -0600
|
||
|
|
Subject: [PATCH] Decoding in slab funcs, replacing "1" with "True" in while.
|
||
|
|
|
||
|
|
The slab functions needed a decode (as noted in
|
||
|
|
https://github.com/linsomniac/python-memcached/pull/175), adapted that
|
||
|
|
patch. Also converted "while 1" to "while True" while I was in there.
|
||
|
|
---
|
||
|
|
memcache.py | 14 +++++++++-----
|
||
|
|
1 file changed, 9 insertions(+), 5 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/memcache.py b/memcache.py
|
||
|
|
index 8c38e56..1aa9987 100644
|
||
|
|
--- a/memcache.py
|
||
|
|
+++ b/memcache.py
|
||
|
|
@@ -323,11 +323,13 @@ class Client(threading.local):
|
||
|
|
serverData = {}
|
||
|
|
data.append((name, serverData))
|
||
|
|
readline = s.readline
|
||
|
|
- while 1:
|
||
|
|
+ while True:
|
||
|
|
line = readline()
|
||
|
|
- if not line or line.decode('ascii').strip() == 'END':
|
||
|
|
+ if line:
|
||
|
|
+ line = line.decode('ascii')
|
||
|
|
+ if not line or line.strip() == 'END':
|
||
|
|
break
|
||
|
|
- stats = line.decode('ascii').split(' ', 2)
|
||
|
|
+ stats = line.split(' ', 2)
|
||
|
|
serverData[stats[1]] = stats[2]
|
||
|
|
|
||
|
|
return data
|
||
|
|
@@ -347,8 +349,10 @@ class Client(threading.local):
|
||
|
|
data.append((name, serverData))
|
||
|
|
s.send_cmd('stats slabs')
|
||
|
|
readline = s.readline
|
||
|
|
- while 1:
|
||
|
|
+ while True:
|
||
|
|
line = readline()
|
||
|
|
+ if line:
|
||
|
|
+ line = line.decode('ascii')
|
||
|
|
if not line or line.strip() == 'END':
|
||
|
|
break
|
||
|
|
item = line.split(' ', 2)
|
||
|
|
@@ -378,7 +382,7 @@ class Client(threading.local):
|
||
|
|
data.append((name, serverData))
|
||
|
|
s.send_cmd('stats items')
|
||
|
|
readline = s.readline
|
||
|
|
- while 1:
|
||
|
|
+ while True:
|
||
|
|
line = readline()
|
||
|
|
if not line or line.strip() == 'END':
|
||
|
|
break
|
||
|
|
--
|
||
|
|
2.43.0
|
||
|
|
|