Skip to content

Commit

Permalink
VkLongPoll: Disable preload_messages by default
Browse files Browse the repository at this point in the history
  • Loading branch information
python273 committed Apr 14, 2018
1 parent c00094c commit 9695b71
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
18 changes: 8 additions & 10 deletions vk_api/longpoll.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,7 @@ class VkLongPoll(object):
VkEventType.MESSAGE_EDIT
]

def __init__(self, vk, wait=25, mode=DEFAULT_MODE, preload_messages=True):

def __init__(self, vk, wait=25, mode=DEFAULT_MODE, preload_messages=False):
self.vk = vk
self.wait = wait
self.mode = mode
Expand Down Expand Up @@ -329,7 +328,12 @@ def check(self):
if self.pts:
self.pts = response['pts']

return [Event(raw_event) for raw_event in response['updates']]
events = [Event(raw_event) for raw_event in response['updates']]

if self.preload_messages:
self.preload_message_events_data(events)

return events

elif response['failed'] == 1:
self.ts = response['ts']
Expand Down Expand Up @@ -371,13 +375,7 @@ def listen(self):
"""

while True:
events = self.check()

# Мне кажется, это должно быть в check
if self.preload_messages:
self.preload_message_events_data(events)

for event in events:
for event in self.check():
yield event


Expand Down
1 change: 0 additions & 1 deletion vk_api/vk_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ def __init__(self, login=None, password=None, token=None,
config=jconfig.Config, config_filename='vk_config.v2.json',
api_version='5.73', app_id=6222115, scope=DEFAULT_USER_SCOPE,
client_secret=None):
# TODO: убрать config_filename, в качестве config брать объект, а не класс

self.login = login
self.password = password
Expand Down

0 comments on commit 9695b71

Please sign in to comment.