mirror of
https://github.com/danog/MadelineProto.git
synced 2025-01-23 10:31:13 +01:00
Properly handle PTS exceptions and decrease polling timeout for groups that do not support passive updates
This commit is contained in:
parent
fbfc2a9faa
commit
06f7b08a32
@ -75,7 +75,6 @@ final class UpdateLoop extends ResumableSignalLoop
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$state = $this->channelId === self::GENERIC ? $API->loadUpdateState() : $API->loadChannelState($this->channelId);
|
$state = $this->channelId === self::GENERIC ? $API->loadUpdateState() : $API->loadChannelState($this->channelId);
|
||||||
$timeout = 10;
|
|
||||||
$first = true;
|
$first = true;
|
||||||
while (true) {
|
while (true) {
|
||||||
if ($this->waitForAuthOrSignal(false)) {
|
if ($this->waitForAuthOrSignal(false)) {
|
||||||
@ -116,13 +115,13 @@ final class UpdateLoop extends ResumableSignalLoop
|
|||||||
}
|
}
|
||||||
throw $e;
|
throw $e;
|
||||||
} catch (PTSException $e) {
|
} catch (PTSException $e) {
|
||||||
|
$feeder->signal(true);
|
||||||
|
$API->getChannelStates()->remove($this->channelId);
|
||||||
|
unset($API->updaters[$this->channelId], $API->feeders[$this->channelId]);
|
||||||
$API->logger->logger("Got PTS exception, exiting update loop for $this: $e", Logger::FATAL_ERROR);
|
$API->logger->logger("Got PTS exception, exiting update loop for $this: $e", Logger::FATAL_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isset($difference['timeout'])) {
|
$timeout = min(1, $difference['timeout'] ?? 1);
|
||||||
$timeout = $difference['timeout'];
|
|
||||||
}
|
|
||||||
$timeout = \min(10, $timeout);
|
|
||||||
$API->logger->logger('Got '.$difference['_'], Logger::ULTRA_VERBOSE);
|
$API->logger->logger('Got '.$difference['_'], Logger::ULTRA_VERBOSE);
|
||||||
switch ($difference['_']) {
|
switch ($difference['_']) {
|
||||||
case 'updates.channelDifferenceEmpty':
|
case 'updates.channelDifferenceEmpty':
|
||||||
@ -162,6 +161,7 @@ final class UpdateLoop extends ResumableSignalLoop
|
|||||||
$API->logger->logger('Resumed and fetching normal difference...', Logger::ULTRA_VERBOSE);
|
$API->logger->logger('Resumed and fetching normal difference...', Logger::ULTRA_VERBOSE);
|
||||||
$difference = $API->methodCallAsyncRead('updates.getDifference', ['pts' => $state->pts(), 'date' => $state->date(), 'qts' => $state->qts()], ['datacenter' => $API->authorized_dc]);
|
$difference = $API->methodCallAsyncRead('updates.getDifference', ['pts' => $state->pts(), 'date' => $state->date(), 'qts' => $state->qts()], ['datacenter' => $API->authorized_dc]);
|
||||||
$API->logger->logger('Got '.$difference['_'], Logger::ULTRA_VERBOSE);
|
$API->logger->logger('Got '.$difference['_'], Logger::ULTRA_VERBOSE);
|
||||||
|
$timeout = 1;
|
||||||
switch ($difference['_']) {
|
switch ($difference['_']) {
|
||||||
case 'updates.differenceEmpty':
|
case 'updates.differenceEmpty':
|
||||||
$state->update($difference);
|
$state->update($difference);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user