mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 09:26:37 +03:00
Implement after_msg_id back
This commit is contained in:
parent
9dc4009152
commit
0686ec4440
|
@ -71,9 +71,9 @@ class MessagePacker:
|
|||
size += len(state.data) + TLMessage.SIZE_OVERHEAD
|
||||
|
||||
if size <= MessageContainer.MAXIMUM_SIZE:
|
||||
# TODO Implement back using after_id
|
||||
state.msg_id = self._state.write_data_as_message(
|
||||
buffer, state.data, isinstance(state.request, TLRequest)
|
||||
buffer, state.data, isinstance(state.request, TLRequest),
|
||||
after_id=state.after.msg_id if state.after else None
|
||||
)
|
||||
batch.append(state)
|
||||
__log__.debug('Assigned msg_id = %d to %s (%x)',
|
||||
|
|
|
@ -161,15 +161,13 @@ class MTProtoSender:
|
|||
else:
|
||||
states = []
|
||||
futures = []
|
||||
state = None
|
||||
for req in request:
|
||||
state = RequestState(req, self._loop)
|
||||
state = RequestState(req, self._loop, after=ordered and state)
|
||||
states.append(state)
|
||||
futures.append(state.future)
|
||||
if ordered:
|
||||
self._send_queue.append(states)
|
||||
else:
|
||||
self._send_queue.extend(states)
|
||||
|
||||
self._send_queue.extend(states)
|
||||
return futures
|
||||
|
||||
@property
|
||||
|
|
|
@ -8,11 +8,12 @@ class RequestState:
|
|||
it belongs to, the request itself, the request as bytes, and the future
|
||||
result that will eventually be resolved.
|
||||
"""
|
||||
__slots__ = ('container_id', 'msg_id', 'request', 'data', 'future')
|
||||
__slots__ = ('container_id', 'msg_id', 'request', 'data', 'future', 'after')
|
||||
|
||||
def __init__(self, request, loop):
|
||||
def __init__(self, request, loop, after=None):
|
||||
self.container_id = None
|
||||
self.msg_id = None
|
||||
self.request = request
|
||||
self.data = bytes(request)
|
||||
self.future = asyncio.Future(loop=loop)
|
||||
self.after = after
|
||||
|
|
Loading…
Reference in New Issue
Block a user