[tor-commits] [stem/master] Make `Controller.get_uptime` asynchronous

atagar at torproject.org atagar at torproject.org
Thu Jul 16 01:28:58 UTC 2020


commit b05a662283397fe0f58986dfda9f087bea3ba159
Author: Illia Volochii <illia.volochii at gmail.com>
Date:   Wed Apr 15 22:13:53 2020 +0300

    Make `Controller.get_uptime` asynchronous
---
 stem/control.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/stem/control.py b/stem/control.py
index f847207f..0e03edfb 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -1650,7 +1650,7 @@ class Controller(BaseController):
       raise ValueError("Unable to resolve when tor began" if self.is_localhost() else "Tor isn't running locally")
 
   @with_default()
-  def get_uptime(self, default: Any = UNDEFINED) -> float:
+  async def get_uptime(self, default: Any = UNDEFINED) -> float:
     """
     get_uptime(default = UNDEFINED)
 
@@ -1666,7 +1666,7 @@ class Controller(BaseController):
       was provided
     """
 
-    return time.time() - self.get_start_time()
+    return time.time() - (await self.get_start_time())
 
   def is_user_traffic_allowed(self) -> 'stem.control.UserTrafficAllowed':
     """





More information about the tor-commits mailing list