rename __register_request_and_wait method to __count_request_and_wait and add counter increment to
This commit is contained in:
parent
8a4bec01c1
commit
c4809a20ea
|
@ -108,12 +108,11 @@ class Notifier:
|
||||||
chat_id=chat_id,
|
chat_id=chat_id,
|
||||||
text=f'Updates from the {feed_title} feed:'
|
text=f'Updates from the {feed_title} feed:'
|
||||||
)
|
)
|
||||||
self.sent_counter += 1
|
|
||||||
|
|
||||||
for update in updates:
|
for update in updates:
|
||||||
self.__register_request_and_wait()
|
self.__register_request_and_wait()
|
||||||
self.__send_update(chat_id, update)
|
self.__send_update(chat_id, update)
|
||||||
self.sent_counter += 1
|
|
||||||
|
|
||||||
def __send_update(self, chat_id: int, update: FeedItem):
|
def __send_update(self, chat_id: int, update: FeedItem):
|
||||||
self.bot.send_message(
|
self.bot.send_message(
|
||||||
|
@ -122,11 +121,12 @@ class Notifier:
|
||||||
parse_mode='HTML'
|
parse_mode='HTML'
|
||||||
)
|
)
|
||||||
|
|
||||||
def __register_request_and_wait(self):
|
def __count_request_and_wait(self):
|
||||||
if self.sent_counter >= self.BATCH_LIMIT:
|
if self.sent_counter >= self.BATCH_LIMIT:
|
||||||
# TODO: probably implement better later
|
# TODO: probably implement better later
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
self.sent_counter = 0
|
self.sent_counter = 0
|
||||||
|
self.sent_counter += 1
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def __format_message(item: FeedItem) -> str:
|
def __format_message(item: FeedItem) -> str:
|
||||||
|
|
Loading…
Reference in a new issue