Minor fixes

This commit is contained in:
Daniil Gentili 2019-05-30 14:19:38 +02:00
parent d42f677884
commit 81302f05fd
4 changed files with 10 additions and 10 deletions

View File

@ -136,7 +136,7 @@ class FeedLoop extends ResumableSignalLoop
$this->updater->setLimit($this->state->pts() + $result);
yield $this->updater->resume();
$updates = array_merge($this->incomingUpdates, $updates);
$this->incomingUpdates = null;
$this->incomingUpdates = [];
continue;
}
if (isset($update['message']['id'], $update['message']['to_id']) && !in_array($update['_'], ['updateEditMessage', 'updateEditChannelMessage'])) {

View File

@ -140,11 +140,11 @@ class SeqLoop extends ResumableSignalLoop
}
public function save($updates)
{
$this->pendingWakeups = array_merge($this->pendingWakeups, yield $this->feeder->feed($updates['updates']));
$this->pendingWakeups += yield $this->feeder->feed($updates['updates']);
}
public function addPendingWakeups($wakeups)
{
$this->pendingWakeups = array_merge($wakeups, $this->pendingWakeups);
$this->pendingWakeups += $wakeups;
}
public function has_all_auth()
{

View File

@ -98,7 +98,7 @@ class UpdateLoop extends ResumableSignalLoop
$difference['pts'] = $state->pts() + 1;
}
$state->update($difference);
$result = array_merge($result, yield $feeder->feed($difference['other_updates']));
$result += yield $feeder->feed($difference['other_updates']);
$feeder->saveMessages($difference['new_messages']);
if (!$difference['final']) {
@ -134,8 +134,8 @@ class UpdateLoop extends ResumableSignalLoop
foreach ($difference['new_encrypted_messages'] as &$encrypted) {
$encrypted = ['_' => 'updateNewEncryptedMessage', 'message' => $encrypted];
}
$result = array_merge($result, yield $feeder->feed($difference['other_updates']));
$result = array_merge($result, yield $feeder->feed($difference['new_encrypted_messages']));
$result += yield $feeder->feed($difference['other_updates']);
$result += yield $feeder->feed($difference['new_encrypted_messages']);
$feeder->saveMessages($difference['new_messages']);
$state->update($difference['state']);
unset($difference);
@ -144,8 +144,8 @@ class UpdateLoop extends ResumableSignalLoop
foreach ($difference['new_encrypted_messages'] as &$encrypted) {
$encrypted = ['_' => 'updateNewEncryptedMessage', 'message' => $encrypted];
}
$result = array_merge($result, yield $feeder->feed($difference['other_updates']));
$result = array_merge($result, yield $feeder->feed($difference['new_encrypted_messages']));
$result += yield $feeder->feed($difference['other_updates']);
$result += yield $feeder->feed($difference['new_encrypted_messages']);
$feeder->saveMessages($difference['new_messages']);
$state->update($difference['intermediate_state']);
if ($difference['intermediate_state']['pts'] >= $toPts) {

View File

@ -580,7 +580,7 @@ trait ResponseHandler
$update['_'] === 'updateEditMessage' || $update['_'] === 'updateDeleteMessages' ||
$update['_'] === 'updateReadHistoryInbox' || $update['_'] === 'updateReadHistoryOutbox' ||
$update['_'] === 'updateWebPage' || $update['_'] === 'updateMessageID') {
$result[yield $this->feeder[false]->feedSingle($update)] = true;
$result[yield $this->feeders[false]->feedSingle($update)] = true;
unset($updates['updates'][$key]);
}
}
@ -596,7 +596,7 @@ trait ResponseHandler
$this->seqUpdater->resume();
break;
case 'updateShort':
$this->feeders[yield $this->feeder[false]->feedSingle($update)]->resume();
$this->feeders[yield $this->feeders[false]->feedSingle($updates['update'])]->resume();
break;
case 'updateShortMessage':
case 'updateShortChatMessage':