mirror of
https://github.com/danog/MadelineProto.git
synced 2025-01-22 21:51:34 +01:00
Properly handle execution time limits (fixes "Must call resume() or throw() before calling suspend() again" errors)
This commit is contained in:
parent
de081572f0
commit
8e3df1e7bf
2
docs
2
docs
@ -1 +1 @@
|
|||||||
Subproject commit a219e8a4f31000bf366993ab269b9ea2a95bbe2c
|
Subproject commit 846f4a03749d57ac166276445f95662dff45eb67
|
@ -20,6 +20,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace danog\MadelineProto;
|
namespace danog\MadelineProto;
|
||||||
|
|
||||||
|
use ReflectionClass;
|
||||||
|
use Revolt\EventLoop;
|
||||||
|
|
||||||
use function Amp\ByteStream\getStdin;
|
use function Amp\ByteStream\getStdin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -48,6 +51,17 @@ final class Shutdown
|
|||||||
*/
|
*/
|
||||||
private static function shutdown(): void
|
private static function shutdown(): void
|
||||||
{
|
{
|
||||||
|
$obj = EventLoop::getSuspension();
|
||||||
|
$reflection = new ReflectionClass($obj);
|
||||||
|
$reflection->getProperty('pending')->setValue($obj, false);
|
||||||
|
$obj = EventLoop::getDriver();
|
||||||
|
$reflection = new ReflectionClass(AbstractDriver::class);
|
||||||
|
if (!$reflection->getProperty('callbackFiber')->isInitialized($obj)
|
||||||
|
|| $reflection->getProperty('callbackFiber')->getValue($obj)->isTerminated()
|
||||||
|
) {
|
||||||
|
$reflection->getMethod('createCallbackFiber')->invoke($obj);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (self::$callbacks as $callback) {
|
foreach (self::$callbacks as $callback) {
|
||||||
$callback();
|
$callback();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user