Commit 68b48d4b authored by Jason Madden's avatar Jason Madden

Fix StorageServer.server_status under Py3K

parent 0afe4447
...@@ -20,6 +20,7 @@ TODO: Need some basic access control-- a declaration of the methods ...@@ -20,6 +20,7 @@ TODO: Need some basic access control-- a declaration of the methods
exported for invocation by the server. exported for invocation by the server.
""" """
import asyncore import asyncore
import codecs
import itertools import itertools
import logging import logging
import os import os
...@@ -1309,8 +1310,12 @@ class StorageServer: ...@@ -1309,8 +1310,12 @@ class StorageServer:
status['connections'] = len(status['connections']) status['connections'] = len(status['connections'])
status['waiting'] = len(self._waiting[storage_id]) status['waiting'] = len(self._waiting[storage_id])
status['timeout-thread-is-alive'] = self.timeouts[storage_id].isAlive() status['timeout-thread-is-alive'] = self.timeouts[storage_id].isAlive()
status['last-transaction'] = ( last_transaction = self.storages[storage_id].lastTransaction()
self.storages[storage_id].lastTransaction().encode('hex')) last_transaction_hex = codecs.encode(last_transaction, 'hex_codec')
if PY3:
# doctests and maybe clients expect a str, not bytes
last_transaction_hex = str(last_transaction_hex, 'ascii')
status['last-transaction'] = last_transaction_hex
return status return status
def ruok(self): def ruok(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment