td icon indicating copy to clipboard operation
td copied to clipboard

Why do all td_receive calls, except the first one, take a long time to receive my specific response?

Open phpcxy opened this issue 1 year ago • 3 comments

Scenario

  1. Initialize TDLib instance
  2. td_send() -> td_receive() quickly returns response
  3. Wait some time
  4. Second td_send() -> td_receive() takes much longer to return response

During the delay in step 4, td_receive() returns other updates (e.g., "updateUser") before the actual response.

Questions

  1. Does TDLib process all accumulated updates before returning a specific operation's response?
  2. Is this behavior intentional? If so, why?
  3. Can we prioritize responses to specific operations over general updates?
  4. How to maintain consistent response times across operations, especially with accumulated updates?

phpcxy avatar Oct 18 '24 04:10 phpcxy

All requests to TDLib are asynchronous. Responses are delivered as soon the request is completed. There is no way to deliver them faster.

levlam avatar Oct 18 '24 06:10 levlam

All requests to TDLib are asynchronous. Responses are delivered as soon the request is completed. There is no way to deliver them faster.

Is it possible that the second request encountered a network issue? How can it be investigated?

phpcxy avatar Oct 18 '24 10:10 phpcxy

It depends on the request. You can check TDLib logs for details.

levlam avatar Oct 18 '24 12:10 levlam