Skip to content

Commit dc6189e

Browse files
author
aavtomonov
committed
improvement
1 parent 5627f25 commit dc6189e

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

‎filter.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@
1717
],
1818
"furnished": true,
1919
"max_price": 1350,
20-
"min_area": 32
20+
"min_area": 35
2121
}

‎src/main/python/notification_sender.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import logging
2-
import time
32
import traceback
43
from os import environ
54

@@ -51,7 +50,6 @@ def send_to_chat(self, notif: Notification):
5150
new_images = []
5251
try:
5352
for c in chunks(notif.pics_urls, 10):
54-
time.sleep(5)
5553
new_images, seen_in_messages = self.image_manager.check_all(notif, c)
5654
seen_in = None if not len(seen_in_messages) else seen_in_messages.pop()
5755
reference_message = None if not seen_in else seen_in.get('message_id')
@@ -85,7 +83,7 @@ def _send_message(self, chat_id, desc, reference_message=None):
8583
reply_to_message_id=reference_message,
8684
disable_notification=reference_message is not None)
8785

88-
@nofail(retries=20, failback_result=None)
86+
@nofail(retries=20, sleep=0.5, failback_result=None)
8987
def _send_pics(self, c, chat_id, desc, **kwargs):
9088
with self.METRICS_NOTIFICATION_TIME.labels('pics').time():
9189
return self.updater.bot.send_media_group(chat_id, [InputMediaPhoto(i, caption=desc) for i in c],

‎src/main/python/runner.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def init_services():
9696
notification_sender.send_to_chat(n)
9797
service.seen_ids.add(n.id, None)
9898
time.sleep(0.5)
99-
sleep_until_next_run_sec = max(60 * SCRAPE_INTERVAL_MIN - (time.time() - last_run), 0)
99+
sleep_until_next_run_sec = max(int(60 * SCRAPE_INTERVAL_MIN - (time.time() - last_run)), 0)
100100

101101
logging.info(f"Done loop, next run in {sleep_until_next_run_sec} sec")
102102
time.sleep(sleep_until_next_run_sec)

0 commit comments

Comments
 (0)