[tor-commits] [sbws/master] Add log.debug around relay refreshing code

pastly at torproject.org pastly at torproject.org
Tue Jun 26 15:36:50 UTC 2018

commit 979c41e1fbb10e7390ab119f09689c095bd2ca12
Author: Matt Traudt <sirmatt at ksu.edu>
Date:   Fri Jun 22 10:02:21 2018 -0400

    Add log.debug around relay refreshing code
 sbws/lib/relaylist.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/sbws/lib/relaylist.py b/sbws/lib/relaylist.py
index 6245aa1..6afa18a 100644
--- a/sbws/lib/relaylist.py
+++ b/sbws/lib/relaylist.py
@@ -136,14 +136,23 @@ class RelayList:
         # See if we can get the list of relays without having to do a refresh,
         # which is expensive and blocks other threads
         if self._need_refresh():
+            log.debug('We need to refresh our list of relays. '
+                      'Going to wait for lock.')
             # Whelp we couldn't just get the list of relays because the list is
             # stale. Wait for the lock so we can refresh it.
             with self._refresh_lock:
+                log.debug('We got the lock. Now to see if we still '
+                          'need to refresh.')
                 # Now we have the lock ... but wait! Maybe someone else already
                 # did the refreshing. So check if it still needs refreshing. If
                 # not, we can do nothing.
                 if self._need_refresh():
+                    log.debug('Yup we need to refresh our relays. Doing so.')
+                else:
+                    log.debug('No we don\'t need to refresh our relays. '
+                              'It was done by someone else.')
+            log.debug('Giving back the lock for refreshing relays.')
         assert not self._need_refresh()
         return self._relays

More information about the tor-commits mailing list