Lonami Exo
45d82f2a85
Fix issues with to/from ID in private chats with multiple clients
...
This should address #1218 .
2019-08-07 00:46:19 +02:00
Lonami Exo
de85c34462
Handle connection error when fetching difference in updates
2019-07-23 21:12:08 +02:00
Lonami Exo
a7a7c4add2
Pass all Updates when building events
2019-06-30 16:34:34 +02:00
Lonami Exo
aa2b3daccc
Factor out setting entities to events
2019-06-30 16:34:34 +02:00
Lonami Exo
b6b4ea669d
Remove messy subclassing in the TelegramClient
...
Since it was easy to cause MRO inconsistencies, and it's
not really needed now that self is type hinted as the client.
2019-06-24 17:48:46 +02:00
Lonami Exo
4c3e467d25
Add a method to cancel_all conversations ( #1183 )
2019-06-03 19:41:22 +02:00
Lonami Exo
4ebf825c43
Clarify documentation on connection and receiving updates
2019-05-23 12:11:58 +02:00
Lonami Exo
7c1c040d50
Update docstrings to have consistent style
2019-05-20 11:57:11 +02:00
Lonami Exo
0a3d6106f0
Completely overhaul the documentation
2019-05-09 12:50:09 +02:00
Lonami Exo
cfd6d3ce04
Fix catch-up when no pts is known
2019-05-08 18:15:57 +02:00
Lonami Exo
d92d989569
Quote type hints
...
Otherwise, sphinx completely butchers the documentation.
2019-05-08 17:16:09 +02:00
Lonami Exo
61613ab6ac
Create a new page with a summary of the method reference
2019-05-06 11:38:26 +02:00
Lonami Exo
945d438696
Properly await all spawned background tasks
2019-05-04 21:02:07 +02:00
Lonami Exo
532bd1c916
Fetch difference only if it is worth it
2019-05-04 19:48:36 +02:00
Lonami Exo
716ab2f96d
Fix getting difference for channels and for the first time
2019-05-04 19:29:47 +02:00
Lonami Exo
cd4b915522
Add type hints to all public methods in the client
2019-05-03 21:38:41 +02:00
Lonami Exo
6d004601d0
Inline the old _load_entities code
2019-05-01 17:07:12 +02:00
Lonami Exo
22124b5ced
Refactor code to fetch missing entities once again
...
This is another attempt at reducing CPU usage similar to:
1b6b4a57d9
In addition it simplifies some of the code and opens up new
ideas for the state cache as well.
2019-05-01 14:02:27 +02:00
Lonami Exo
599a5ac3ff
Fix using events.Raw after 1b6b4a5
2019-04-29 08:54:10 +02:00
Lonami Exo
1b6b4a57d9
Attempt at reducing CPU usage after c902428
...
This attempt removes the forced `await` call, which could
be causing that extra usage. Some more boilerplate is needed.
2019-04-23 20:17:43 +02:00
Lonami Exo
4e783728f9
Don't catch up on reconnect and fix typo
...
The feature is not ready yet.
2019-04-22 16:56:32 +02:00
Lonami Exo
a151d24951
Fix StateCache accessing None to_id and add logging ( #1160 )
2019-04-22 12:24:45 +02:00
Lonami Exo
fee0923dd1
Get difference for missing entities in channels too
2019-04-21 21:24:34 +02:00
Lonami Exo
c1880c9191
Fix pts from channels is different ( #1160 )
2019-04-21 13:56:14 +02:00
Lonami Exo
fadc343821
Fix catch_up pts loading and remember pts per update
2019-04-13 09:12:59 +02:00
Lonami Exo
9965cda968
Save pts and date in a tuple for immutability
...
This way it is easy and cheap to copy the two required values
to all incoming updates in case we need to getDifference since
the previous pts/date to fetch entities.
This is still a work in progress.
2019-04-10 21:10:34 +04:00
Lonami Exo
3398bee77a
Handle disconnection errors more gracefully in background tasks
2019-04-01 08:46:07 +02:00
Lonami Exo
5377169db2
Call catch_up on reconnect (WIP for #1125 )
2019-03-28 12:32:02 +01:00
Lonami Exo
39d9531483
Implement _load_entities for all events
...
Follow-up of c902428af1
This means that now input_chat (and even chat_id) and
similar can be safely used, without needing get_input
2019-03-28 10:47:15 +01:00
Lonami Exo
c902428af1
getDifference if the event's chat was not found (WIP)
2019-03-27 16:21:17 +01:00
Lonami Exo
4d35e8c80f
Create a new in-memory cache for entities ( #1141 )
2019-03-26 11:27:52 +01:00
Lonami Exo
9eabca6987
Fix run_until_disconnected's call to disconnect
2019-03-22 18:20:10 +01:00
Lonami Exo
347db79979
run_until_disconnected() should disconnect() on finally
2019-03-21 12:25:19 +01:00
Lonami Exo
04ba2e1fc7
Revert disconnect() to be async again ( #1133 )
...
It's the only way to properly clean all background tasks,
which the library makes heavy use for in MTProto/Connection
send and receive loops.
Some parts of the code even relied on the fact that it was
asynchronous (it used to return a future so you could await
it and not be breaking).
It's automatically syncified to reduce the damage of being
a breaking change.
2019-03-21 12:21:00 +01:00
Tulir Asokan
f271316d7d
Make logger fully configurable ( #1087 )
2019-01-11 15:52:30 +01:00
Lonami Exo
f9fc433c0f
Better catch_up behaviour when invalid states are present
2018-12-06 16:07:11 +01:00
Lonami Exo
424079aa12
Fix pts initialized as -1 not being considered
2018-12-04 21:07:18 +01:00
Lonami Exo
0755421fc2
Fix update loop should not disconnect causing race condition
...
When starting the client, on phone migrations, it would
disconnect twice right after connecting which would
trigger a not-connected error.
2018-10-21 16:02:13 +02:00
Lonami Exo
9cbc088b76
Make disconnect synchronous
...
This also fixes a bug when auto-reconnecting in MTProtoSender.
2018-10-16 11:56:17 +02:00
Lonami Exo
0094eb391e
Support exclusive conversations by default
2018-10-12 22:17:07 +02:00
Lonami Exo
cf6686ff42
Revert async sessions from 3dd8b7c
(breaks sync properties)
...
Such as ChatGetter.input_chat and SenderGetter.input_sender
which rely on the fact that access to the session file will
be synchronous.
2018-10-12 22:00:02 +02:00
Lonami Exo
fb9660afe0
Add missing awaits
2018-10-06 12:39:07 +02:00
josephbiko
3dd8b7c6d1
Support async def in sessions ( #1013 )
2018-10-05 20:25:49 +02:00
Lonami Exo
d5d3733fd4
Create events.register and siblings for "handler templates"
...
This can be thought of as a different approach to Flask's blueprints.
2018-09-22 12:51:58 +02:00
Lonami Exo
8a9650f131
Fix-up previous commit 0bb0d0b
missing parameter
2018-08-27 10:58:06 +02:00
Lonami Exo
576ac666d9
Fix resolving events while disconnected
2018-08-27 01:20:01 +02:00
Lonami Exo
d3a6822fc9
Properly resolve events
2018-08-21 12:18:12 +02:00
Lonami Exo
d474458136
Simplify event resolving logic
...
Although this commit introduces a race condition since an
event may only be half-resolved. A lock is thus needed,
but it depends on an event-loop to which we don't have
access in the class-level.
2018-08-21 11:08:08 +02:00
Lonami Exo
9f237cc928
Simplify event building logic
...
This will also fix some bugs where the event type being accessed
would not be available, since it is now built on-demand, without
the need to keep track for the count of each event type.
2018-08-21 10:27:12 +02:00
Lonami Exo
7efa53fedf
Update to v1.2
2018-08-14 18:48:56 +02:00
Lonami Exo
653686996a
Revisit catch_up ( #808 )
2018-08-13 12:32:12 +02:00
Lonami Exo
48113851a8
Fix built Conversation events don't have the client
2018-08-05 02:01:06 +02:00
Lonami Exo
ca40a9c282
Add Conversation.wait_event
2018-08-05 01:55:41 +02:00
Lonami Exo
785ef7676f
Create a basic custom.Conversation
2018-08-03 17:51:56 +02:00
Lonami Exo
46b2d910d7
Fix logging of functools.partial() callbacks
2018-07-21 17:52:42 +02:00
Lonami Exo
22c8fd7378
Fix Updates object being dispatched to user handlers
2018-07-12 09:45:29 +02:00
Lonami Exo
1d0fd6801d
Build events only once per update
2018-07-11 11:22:43 +02:00
Lonami Exo
81f31e09c8
Keep track of how many events for each type were added
2018-07-11 10:50:19 +02:00
Lonami
ac5f8da50c
Fix update.pts may be None
2018-07-10 16:59:40 +02:00
josephbiko
e6981e7676
Remove empty except ( #887 )
2018-07-09 20:54:43 +02:00
Lonami Exo
3c2ff45b0b
Support dispatching updates in a sequential order
2018-06-29 10:45:04 +02:00
Lonami Exo
a6782ac6ea
Send getState upon successful reconnection
2018-06-27 19:40:32 +02:00
Lonami Exo
c0412e4410
Fix run_until_disconnected disconnect with telethon.sync
2018-06-27 19:39:47 +02:00
Lonami Exo
6152e33454
Fix sync run_until_disconnected not liking Ctrl+C
2018-06-26 15:48:38 +02:00
Lonami Exo
75dc4809f5
Remove all deprecated methods
2018-06-26 11:10:11 +02:00
Lonami Exo
9c6d2894fc
Allow start when the loop is not running
2018-06-25 13:42:29 +02:00
Lonami Exo
db5cb74bdd
Allow run_until_disconnected when the loop is running
2018-06-25 13:32:31 +02:00
Lonami Exo
d4479a0a4e
Save the session file less often
2018-06-24 12:21:58 +02:00
Lonami Exo
3d3698562b
Cleanly handle KeyboardInterrupt in run_until_disconnected
2018-06-22 13:26:24 +02:00
Lonami Exo
a1477a84bf
Update in-memory updates.State
2018-06-20 19:58:01 +02:00
Lonami Exo
c85ba4accc
Revisit documentation, cross-references and unnecessary indents
2018-06-20 11:06:03 +02:00
Lonami Exo
262018959f
Process entities from sent requests/updates
2018-06-18 20:44:20 +02:00
Lonami Exo
51d8ea0fa8
Shield disconnected Future in the MTProtoSender instead
2018-06-18 15:55:24 +02:00
Lonami Exo
efc48ee3b0
Shield self.disconnected and log RpcCallFail
2018-06-18 14:28:30 +02:00
Lonami Exo
374f5e2aab
Periodically send ping/getState
2018-06-18 13:22:25 +02:00
Dan Elkouby
d5b349e031
Implement a mechanism to notify of connection failures ( #852 )
2018-06-17 19:29:41 +02:00
Lonami Exo
31c94ec184
Add a lock for resolving events
2018-06-15 10:11:43 +02:00
Lonami Exo
091b03c635
Use create_task instead ensure_future
2018-06-14 23:33:56 +02:00
Lonami Exo
c788e17c22
Fix _handle_update not expanding Updates
2018-06-14 22:51:57 +02:00
Lonami Exo
0f14f3b16a
Support custom event loops
2018-06-14 19:35:12 +02:00
Lonami Exo
3ce8b17193
Dispatch updates to event handlers
2018-06-13 16:20:15 +02:00
Lonami Exo
fb8b052754
Separate update requests from the TelegramClient
2018-06-10 13:58:21 +02:00