dont ack the message when empty list

This commit is contained in:
2024-01-18 17:30:27 +01:00
parent 455997a71c
commit 47cf77e049
+4
View File
@@ -94,6 +94,7 @@ class Receiver(threading.Thread):
if len(self.contact_list) > 0: if len(self.contact_list) > 0:
captchaResultGetter = CaptchaResultGetter() captchaResultGetter = CaptchaResultGetter()
print("contact number is {}".format(len(self.contact_list))) print("contact number is {}".format(len(self.contact_list)))
self.contact_list = filter_contacts(self.contact_list)
for con in self.contact_list: for con in self.contact_list:
# if not is_already_sent(con): # if not is_already_sent(con):
print(con.mail) print(con.mail)
@@ -109,9 +110,12 @@ class Receiver(threading.Thread):
self.valid_csrf = None self.valid_csrf = None
# else: # else:
# print(con.mail + "--> skip") # print(con.mail + "--> skip")
time.sleep(random.randint(1, 2))
ch.basic_ack(delivery_tag=method.delivery_tag) ch.basic_ack(delivery_tag=method.delivery_tag)
else: else:
print("empty list") print("empty list")
time.sleep(120)
ch.basic_reject(delivery_tag=method.delivery_tag, requeue=True)
def run(self): def run(self):
print(threading.currentThread().name + " starts") print(threading.currentThread().name + " starts")