Giter Site home page Giter Site logo

ConnectionResetError about ll-mtproto HOT 10 CLOSED

andrew-ld avatar andrew-ld commented on August 27, 2024
ConnectionResetError

from ll-mtproto.

Comments (10)

andrew-ld avatar andrew-ld commented on August 27, 2024 1

fixed

from ll-mtproto.

andrew-ld avatar andrew-ld commented on August 27, 2024

you can't use time.sleep because it blocks the asyncio loop, you have to use its alternative "await asyncio.sleep"

from ll-mtproto.

andrew-ld avatar andrew-ld commented on August 27, 2024

same result even if we run rpc calls continuously without sleep.

this is because telegram limits the number of requests that can be made on a single mtproto connection, if it is exceeded you are blocked and have to reconnect.

from ll-mtproto.

iamDonkey avatar iamDonkey commented on August 27, 2024

from ll-mtproto.

iamDonkey avatar iamDonkey commented on August 27, 2024

raise ValueError("Too many requests!")

from ll-mtproto.

andrew-ld avatar andrew-ld commented on August 27, 2024

yes

from ll-mtproto.

andrew-ld avatar andrew-ld commented on August 27, 2024

at high level only ConnectionResetError is given, at low level in the mtproto module the error is different based on what it is but this is only shown in the python logs in the error level.

from ll-mtproto.

andrew-ld avatar andrew-ld commented on August 27, 2024

logging.error("failure while read message from mtproto: %s", traceback.format_exc())

from ll-mtproto.

iamDonkey avatar iamDonkey commented on August 27, 2024
while True:
            dialogs = await session.rpc_call(
            {
                "_cons": "messages.getDialogs",
                "flags": 1,
                "hash": 0,
                "offset_peer": {"_cons": "inputPeerEmpty"},
                "offset_id": 0,
                "offset_date": 0,
                "offset": 0,
                "max_id": 0,
                "limit": 100,
            })
            #print(dialogs)
            await asyncio.sleep(5)

can you check above code?

DEBUG:root:disconnected from Telegram
DEBUG:root:disconnected from Telegram
DEBUG:root:connecting to Telegram at 149.154.167.91:443
DEBUG:root:sending message (invokeWithLayer) 7098948223390284988 to mtproto
DEBUG:root:sending message (get_future_salts) 7098948223406214400 to mtproto
DEBUG:root:sending message (updates.getState) 7098948223416016168 to mtproto
DEBUG:root:sending message (messages.getDialogs) 7098948223428451984 to mtproto
DEBUG:root:received message (rpc_result) 7098948223410395137 from mtproto
DEBUG:root:sending message (msgs_ack) 7098948223442698004 to mtproto
DEBUG:root:received message (future_salts) 7098948223416303617 from mtproto
DEBUG:root:scheduling get_future_salts, current salt is valid for 1801 seconds
DEBUG:root:received message (msg_container) 7098948223452849153 from mtproto
DEBUG:root:sending message (msgs_ack) 7098948223475808032 to mtproto
DEBUG:root:received message (rpc_result) 7098948223861139457 from mtproto
DEBUG:root:sending message (msgs_ack) 7098948223914742824 to mtproto
DEBUG:root:sending message (messages.getDialogs) 7098948245422259164 to mtproto
DEBUG:root:received message (rpc_result) 7098948245962530817 from mtproto
DEBUG:root:sending message (msgs_ack) 7098948246007004280 to mtproto
DEBUG:root:disconnected from Telegram
DEBUG:root:disconnected from Telegram
DEBUG:root:connecting to Telegram at 149.154.167.91:443
DEBUG:root:sending message (invokeWithLayer) 7098948267493938284 to mtproto
DEBUG:root:sending message (get_future_salts) 7098948267514313972 to mtproto
DEBUG:root:sending message (updates.getState) 7098948267521636800 to mtproto
DEBUG:root:sending message (messages.getDialogs) 7098948267527355804 to mtproto
DEBUG:root:received message (msg_container) 7098948267522002945 from mtproto
DEBUG:root:scheduling get_future_salts, current salt is valid for 1801 seconds
DEBUG:root:received message (msg_container) 7098948267900705793 from mtproto
DEBUG:root:sending message (msgs_ack) 7098948267926026220 to mtproto
DEBUG:root:received message (rpc_result) 7098948268031158273 from mtproto
DEBUG:root:sending message (msgs_ack) 7098948268055064720 to mtproto
DEBUG:root:received message (rpc_result) 7098948268239378433 from mtproto
DEBUG:root:sending message (msgs_ack) 7098948268287761780 to mtproto

can clearly know connection is dying in 10 seconds.

from ll-mtproto.

iamDonkey avatar iamDonkey commented on August 27, 2024

thanks @andrew-ld

from ll-mtproto.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.