remove extra logging

This commit is contained in:
Alexander Zveruk 2020-05-15 10:35:31 +03:00
parent c7031d0533
commit 939ea46e09
2 changed files with 5 additions and 9 deletions

View file

@ -87,9 +87,7 @@ class Model:
chats_left = page_size - current_position chats_left = page_size - current_position
offset = max(msgs_left_scroll_threshold - chats_left, 0) offset = max(msgs_left_scroll_threshold - chats_left, 0)
limit = offset + page_size limit = offset + page_size
rv = self.chats.fetch_chats(offset=offset, limit=limit) return self.chats.fetch_chats(offset=offset, limit=limit)
log.info(f"4242 {limit=} {offset=} {len(rv)=}in get chats")
return rv
def send_message(self, text: str) -> bool: def send_message(self, text: str) -> bool:
chat_id = self.chats.id_by_index(self.current_chat) chat_id = self.chats.id_by_index(self.current_chat)
@ -123,12 +121,13 @@ class ChatModel:
if offset + limit > len(self.chats): if offset + limit > len(self.chats):
self._load_next_chats() self._load_next_chats()
log.info(
f"4242 fetcl chat ids {len(self.chat_ids)=} {limit=} {offset=}"
)
return self.chats[offset:limit] return self.chats[offset:limit]
def _load_next_chats(self): def _load_next_chats(self):
"""
based on
https://github.com/tdlib/td/issues/56#issuecomment-364221408
"""
if self.have_full_chat_list: if self.have_full_chat_list:
return None return None
offset_order = 2 ** 63 - 1 offset_order = 2 ** 63 - 1
@ -146,9 +145,7 @@ class ChatModel:
return None return None
chats = result.update["chat_ids"] chats = result.update["chat_ids"]
log.info(f"42422 {chats=}")
if not chats: if not chats:
log.info(f"4242 returned no chats")
self.have_full_chat_list = True self.have_full_chat_list = True
return chats return chats

View file

@ -167,7 +167,6 @@ class ChatView:
wide_char_len = sum(map(len, emoji_pattern.findall(last_msg))) wide_char_len = sum(map(len, emoji_pattern.findall(last_msg)))
last_msg = last_msg[: self.w - offset - 1 - wide_char_len] last_msg = last_msg[: self.w - offset - 1 - wide_char_len]
# log.info(f"4242, {i=}, {offset=} {len(last_msg)=}")
self.win.addstr(i, offset, last_msg, self._msg_color(is_selected)) self.win.addstr(i, offset, last_msg, self._msg_color(is_selected))
if left_label := self._get_chat_label(unread_count, chat): if left_label := self._get_chat_label(unread_count, chat):