Correctly handle flood_sleep_threshold=None and large values

The docstring said large values would be converted to 1 day,
but they were not. With this change None and large values are
handled correctly.

Prevents https://github.com/tulir/mautrix-telegram/issues/380.
This commit is contained in:
Lonami Exo 2019-11-18 12:51:18 +01:00
parent 6817e19923
commit 3a56c8b0f4

View File

@ -382,6 +382,15 @@ class TelegramBaseClient(abc.ABC):
"""
return self._sender.disconnected
@property
def flood_sleep_threshold(self):
return self._flood_sleep_threshold
@flood_sleep_threshold.setter
def flood_sleep_threshold(self, value):
# None -> 0, negative values don't really matter
self._flood_sleep_threshold = min(value or 0, 24 * 60 * 60)
# endregion
# region Connecting