[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit c275dbb392fa46a869c2889e9ac49d8a338461c9
Author: hiro <hiro@xxxxxxxxxxxxxx>
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.

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