From b4c5585a3e1ded3a9974cb8d00f9556ee0f1906a Mon Sep 17 00:00:00 2001 From: ThomasV Date: Wed, 13 Jun 2012 18:30:55 +0400 Subject: [PATCH] adding server.load command --- backends/irc/__init__.py | 4 ++++ server.py | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/backends/irc/__init__.py b/backends/irc/__init__.py index 87b6fa0..edd9dc9 100644 --- a/backends/irc/__init__.py +++ b/backends/irc/__init__.py @@ -143,6 +143,10 @@ class ServerProcessor(Processor): "subscriptions":len(s.subscriptions)}, self.dispatcher.request_dispatcher.get_sessions()) + elif method == 'server.load': + p = self.dispatcher.request_dispatcher.processors['blockchain'] + result = p.queue.qsize() + else: print "unknown method", request diff --git a/server.py b/server.py index 1111521..c636c0c 100755 --- a/server.py +++ b/server.py @@ -70,8 +70,8 @@ def run_rpc_command(command, stratum_tcp_port): if msg.find('\n') != -1: break s.close() r = json.loads(msg).get('result') - if command == 'stop': print r - elif command == 'info': + + if command == 'info': now = time.time() print 'type address sub version time' for item in r: @@ -80,6 +80,8 @@ def run_rpc_command(command, stratum_tcp_port): item.get('subscriptions'), item.get('version'), (now - item.get('time')) ) + else: + print r if __name__ == '__main__': config = create_config() -- 1.7.1