Maintain a sorted list of stored_msg_ids

This commit is contained in:
Dan 2021-12-15 15:04:44 +01:00
parent cd027b8c1c
commit bc420da0e2

View File

@ -16,6 +16,7 @@
# You should have received a copy of the GNU Lesser General Public License # You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>. # along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
import bisect
from hashlib import sha256 from hashlib import sha256
from io import BytesIO from io import BytesIO
from os import urandom from os import urandom
@ -118,6 +119,6 @@ def unpack(
if time_diff < -300: if time_diff < -300:
return None return None
stored_msg_ids.append(message.msg_id) bisect.insort(stored_msg_ids, message.msg_id)
return message return message