From f54a5141e90d672076c0db8baf4b7ee4c89c2c8a Mon Sep 17 00:00:00 2001
From: Holger Nahrstaedt <holger@nahrstaedt.de>
Date: Sat, 28 Apr 2018 08:22:32 +0200
Subject: [PATCH] Improve pingnode and prepare readme for release

---
 README.rst                   |  9 +++++++++
 beem/cli.py                  | 11 ++++++++---
 examples/benchmark_nodes2.py |  2 +-
 3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/README.rst b/README.rst
index a6a09806..043bebdb 100644
--- a/README.rst
+++ b/README.rst
@@ -128,6 +128,15 @@ Documentation is available at http://beem.readthedocs.io/en/latest/
 
 Changelog
 =========
+0.19.24
+-------
+* AsciiChart for beempy: pricehistory, tradehistory and orderbook
+* Sort nodes regarding their ping times (beempy ping --sort --remove)
+* currentnode and nextnode skip not working nodes
+* Memory consumption fer requests and websocket reduced when creating more instances of steem
+* trade_history added to market
+* Issue #4 fixed
+
 0.19.23
 -------
 * new function for beempy added: power, follower, following, muter, muting, mute, nextnode, pingnode, currentnode 
diff --git a/beem/cli.py b/beem/cli.py
index 685a64ae..73df67b1 100644
--- a/beem/cli.py
+++ b/beem/cli.py
@@ -247,15 +247,20 @@ def pingnode(raw, sort, remove):
     if sort:
         ping_times = []
         for node in nodes:
+            ping_times.append(1000.)
+        for i in range(len(nodes)):
             try:
-                stm_local = Steem(node=node, num_retries=2, num_retries_call=3, timeout=5)
+                stm_local = Steem(node=nodes[i], num_retries=2, num_retries_call=3, timeout=10)
                 start = timer()
                 stm_local.get_config(use_stored_data=False)
                 stop = timer()
                 rpc_answer_time = stop - start
-                ping_times.append(rpc_answer_time)
+                ping_times[i] = rpc_answer_time
+            except KeyboardInterrupt:
+                break
             except:
-                ping_times.append(float("inf"))
+                ping_times[i] = float("inf")
+            print("node %s results in %.2f" % (nodes[i], ping_times[i]))
         sorted_arg = sorted(range(len(ping_times)), key=ping_times.__getitem__)
         sorted_nodes = []
         for i in sorted_arg:
diff --git a/examples/benchmark_nodes2.py b/examples/benchmark_nodes2.py
index a0c6fe7a..5cded765 100644
--- a/examples/benchmark_nodes2.py
+++ b/examples/benchmark_nodes2.py
@@ -40,7 +40,7 @@ if __name__ == "__main__":
     for node in nodes:
         print("Current node:", node)
         try:
-            stm = Steem(node=node, num_retries=2, num_retries_call=3, timeout=5)
+            stm = Steem(node=node, num_retries=2, num_retries_call=3, timeout=10)
             blockchain = Blockchain(steem_instance=stm)
             account = Account("gtg", steem_instance=stm)
             virtual_op_count = account.virtual_op_count()
-- 
GitLab