commit 09dcc95f2c4e50477e1b0938cc83e58677e2288e
Author: Damian Johnson <ata...@torproject.org>
Date:   Sat Oct 31 14:32:04 2020 -0700

    Make Query.start() synchronous
    
    This class method initializes an asynchronous process. There's no benefit in
    this method itself being asynchronous. This only was to ensure there's a 
loop
    available, but our Synchronous parent provides that.
---
 stem/descriptor/remote.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/stem/descriptor/remote.py b/stem/descriptor/remote.py
index 2e9ec641..e8367e8b 100644
--- a/stem/descriptor/remote.py
+++ b/stem/descriptor/remote.py
@@ -436,17 +436,14 @@ class Query(Synchronous):
     if block:
       self.run(True)
 
-  async def start(self) -> None:
+  def start(self) -> None:
     """
     Starts downloading the scriptors if we haven't started already.
     """
 
     with self._downloader_lock:
       if self._downloader_task is None:
-        # TODO: replace with get_running_loop() when we remove python 3.6 
support
-
-        loop = asyncio.get_event_loop()
-        self._downloader_task = 
loop.create_task(self._download_descriptors(self.retries, self.timeout))
+        self._downloader_task = 
self._loop.create_task(Query._download_descriptors(self, self.retries, 
self.timeout))
 
   async def run(self, suppress: bool = False) -> 
List['stem.descriptor.Descriptor']:
     """
@@ -473,7 +470,7 @@ class Query(Synchronous):
 
   async def _run(self, suppress: bool) -> 
AsyncIterator[stem.descriptor.Descriptor]:
     with self._downloader_lock:
-      await self.start()
+      self.start()
       await self._downloader_task
 
       if self.error:



_______________________________________________
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits

Reply via email to