mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-30 09:38:57 +01:00
Improve performance
This commit is contained in:
parent
30d437e294
commit
1dbbc0d441
@ -62,7 +62,7 @@ final class WriteLoop extends Loop
|
||||
}
|
||||
if ($please_wait) {
|
||||
$this->API->logger("Have to wait for handshake, pausing in $this...", Logger::ULTRA_VERBOSE);
|
||||
return self::PAUSE;
|
||||
return 1.0;
|
||||
}
|
||||
$this->connection->writing(true);
|
||||
try {
|
||||
|
@ -64,8 +64,9 @@ trait CallHandler
|
||||
$message->setMsgId(null);
|
||||
$message->setSeqNo(null);
|
||||
EventLoop::queue(function () use ($datacenter, $message): void {
|
||||
// Do not postpone, hot path due to DC migration API errors
|
||||
$this->API->datacenter->waitGetConnection($datacenter)
|
||||
->sendMessage($message, true);
|
||||
->sendMessage($message, false);
|
||||
});
|
||||
} else {
|
||||
/** @var MTProtoOutgoingMessage */
|
||||
@ -73,6 +74,7 @@ trait CallHandler
|
||||
if (!$message->hasSeqNo()) {
|
||||
$this->gotResponseForOutgoingMessage($message);
|
||||
}
|
||||
// Postpone, cold path due to rare MTProto errors
|
||||
EventLoop::queue($this->sendMessage(...), $message, true);
|
||||
}
|
||||
} else {
|
||||
|
@ -344,7 +344,7 @@ trait ResponseHandler
|
||||
$this->API->authorized_dc = $this->API->datacenter->currentDatacenter;
|
||||
}
|
||||
$this->API->logger("Resending $request to new DC $datacenter...");
|
||||
EventLoop::queue($this->methodRecall(...), $request->getMsgId(), $datacenter);
|
||||
$this->methodRecall($request->getMsgId(), $datacenter);
|
||||
return null;
|
||||
case 400:
|
||||
if ($request->previousQueuedMessage &&
|
||||
|
Loading…
Reference in New Issue
Block a user