adding server.load command
authorThomasV <thomasv@gitorious>
Wed, 13 Jun 2012 14:30:55 +0000 (18:30 +0400)
committerThomasV <thomasv@gitorious>
Wed, 13 Jun 2012 14:30:55 +0000 (18:30 +0400)
backends/irc/__init__.py
server.py

index 87b6fa0..edd9dc9 100644 (file)
@@ -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
 
index 1111521..c636c0c 100755 (executable)
--- 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()