Bugfixes
This commit is contained in:
parent
e38ecb9010
commit
2118665a29
18
CHANGELOG.md
18
CHANGELOG.md
@ -3,7 +3,19 @@
|
|||||||
|
|
||||||
## 4.0.0 Full async
|
## 4.0.0 Full async
|
||||||
|
|
||||||
Full async
|
**Fully asynchronous MadelineProto, thanks to [amphp](https://github.com/danog/amphp)!**
|
||||||
|
|
||||||
Improved message splitting algorithm: performance improvements, and it will now notify you via the logs if there are too many entities in the logs, or if the entities are too long.
|
* Fully rewritten connection stack, with support for websockets, stuff
|
||||||
Improved get_self method.
|
* updates
|
||||||
|
* Improved message splitting algorithm: performance improvements, and it will now notify you via the logs if there are too many entities in the logs, or if the entities are too long.
|
||||||
|
* Improved get_self method.
|
||||||
|
* Rewritten proxy stack
|
||||||
|
|
||||||
|
|
||||||
|
Things to expect in the next releases:
|
||||||
|
Document async apis
|
||||||
|
optional max_id and min_id
|
||||||
|
async iterators
|
||||||
|
Method name changes
|
||||||
|
#MadelineProtoForNode async
|
||||||
|
lua async
|
@ -64,6 +64,7 @@ trait ResponseHandler
|
|||||||
while ($this->datacenter->sockets[$datacenter]->new_incoming) {
|
while ($this->datacenter->sockets[$datacenter]->new_incoming) {
|
||||||
reset($this->datacenter->sockets[$datacenter]->new_incoming);
|
reset($this->datacenter->sockets[$datacenter]->new_incoming);
|
||||||
$current_msg_id = key($this->datacenter->sockets[$datacenter]->new_incoming);
|
$current_msg_id = key($this->datacenter->sockets[$datacenter]->new_incoming);
|
||||||
|
if (!isset($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id])) continue;
|
||||||
$this->logger->logger((isset($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['from_container']) ? 'Inside of container, received ' : 'Received ').$this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['_'].' from DC '.$datacenter, \danog\MadelineProto\Logger::ULTRA_VERBOSE);
|
$this->logger->logger((isset($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['from_container']) ? 'Inside of container, received ' : 'Received ').$this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['_'].' from DC '.$datacenter, \danog\MadelineProto\Logger::ULTRA_VERBOSE);
|
||||||
|
|
||||||
switch ($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['_']) {
|
switch ($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['_']) {
|
||||||
|
@ -22,9 +22,6 @@ namespace danog\MadelineProto\MTProtoTools;
|
|||||||
use Amp\Artax\Request;
|
use Amp\Artax\Request;
|
||||||
use Amp\Deferred;
|
use Amp\Deferred;
|
||||||
use Amp\Delayed;
|
use Amp\Delayed;
|
||||||
use function Amp\Promise\any;
|
|
||||||
use danog\MadelineProto\Loop\Update\FeedLoop;
|
|
||||||
use danog\MadelineProto\Loop\Update\UpdateLoop;
|
|
||||||
use Amp\Loop;
|
use Amp\Loop;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -81,7 +78,7 @@ trait UpdateHandler
|
|||||||
if (!$params['timeout']) {
|
if (!$params['timeout']) {
|
||||||
$params['timeout'] = 0.001;
|
$params['timeout'] = 0.001;
|
||||||
}
|
}
|
||||||
yield any([$this->waitUpdate(), new Delayed($params['timeout'] * 1000)]);
|
yield $this->any([$this->waitUpdate(), new Delayed($params['timeout'] * 1000)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->updates)) {
|
if (empty($this->updates)) {
|
||||||
|
@ -24,6 +24,7 @@ use Amp\Loop;
|
|||||||
use Amp\Promise;
|
use Amp\Promise;
|
||||||
use Amp\Success;
|
use Amp\Success;
|
||||||
use function Amp\Promise\all;
|
use function Amp\Promise\all;
|
||||||
|
use function Amp\Promise\any;
|
||||||
use function Amp\Promise\wait;
|
use function Amp\Promise\wait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -230,6 +231,13 @@ trait Tools
|
|||||||
}
|
}
|
||||||
return all($promises);
|
return all($promises);
|
||||||
}
|
}
|
||||||
|
public function any($promises)
|
||||||
|
{
|
||||||
|
foreach ($promises as &$promise) {
|
||||||
|
$promise = $this->call($promise);
|
||||||
|
}
|
||||||
|
return any($promises);
|
||||||
|
}
|
||||||
public function call($promise)
|
public function call($promise)
|
||||||
{
|
{
|
||||||
if ($promise instanceof \Generator) {
|
if ($promise instanceof \Generator) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user