[tor-commits] [gettor/master] Fix twitter parser logic

hiro at torproject.org hiro at torproject.org
Tue Oct 15 17:21:17 UTC 2019


commit c275dbb392fa46a869c2889e9ac49d8a338461c9
Author: hiro <hiro at torproject.org>
Date:   Tue Oct 15 19:21:07 2019 +0200

    Fix twitter parser logic
---
 gettor/parse/twitter.py | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/gettor/parse/twitter.py b/gettor/parse/twitter.py
index 82ae80c..0c8a0fb 100644
--- a/gettor/parse/twitter.py
+++ b/gettor/parse/twitter.py
@@ -120,14 +120,7 @@ class TwitterParser(object):
                 id=hid.hexdigest(), service=request['service']
             )
 
-            if num_requests[0][0] > twitter_requests_limit:
-                log.msg(
-                    "Discarded. Too many requests from {}.".format(
-                        hid.hexdigest
-                    ), system="twitter parser"
-            )
-
-            else:
+            if num_requests[0][0] < twitter_requests_limit:
                 conn.new_request(
                     id=str(request['id']),
                     command=request['command'],
@@ -138,6 +131,14 @@ class TwitterParser(object):
                     status="ONHOLD",
                 )
 
+            else:
+                log.msg(
+                    "Discarded. Too many requests from {}.".format(
+                        hid.hexdigest
+                    ), system="twitter parser"
+                )
+
+
     def parse_errback(self, error):
         """
         Errback if we don't/can't parse the message's content.



More information about the tor-commits mailing list