Defer resolution of update deferred
This commit is contained in:
parent
34e957e811
commit
48dad117c2
@ -99,7 +99,9 @@ class ReadLoop extends SignalLoop
|
|||||||
$connection->http_res_count++;
|
$connection->http_res_count++;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
$API->logger->logger("Handling messages from DC ".$datacenter, \danog\MadelineProto\Logger::ULTRA_VERBOSE);
|
||||||
$API->handle_messages($datacenter);
|
$API->handle_messages($datacenter);
|
||||||
|
$API->logger->logger("Handled messages from DC ".$datacenter, \danog\MadelineProto\Logger::ULTRA_VERBOSE);
|
||||||
} finally {
|
} finally {
|
||||||
$this->exitedLoop();
|
$this->exitedLoop();
|
||||||
}
|
}
|
||||||
|
@ -543,6 +543,8 @@ trait ResponseHandler
|
|||||||
$botAPI = isset($request['botAPI']) && $request['botAPI'];
|
$botAPI = isset($request['botAPI']) && $request['botAPI'];
|
||||||
unset($request);
|
unset($request);
|
||||||
$this->got_response_for_outgoing_message_id($request_id, $datacenter);
|
$this->got_response_for_outgoing_message_id($request_id, $datacenter);
|
||||||
|
$r = isset($response['_']) ? $response['_'] : json_encode($response);
|
||||||
|
$this->logger->logger("Defer sending $r to deferred");
|
||||||
$this->callFork((
|
$this->callFork((
|
||||||
function () use ($request_id, $response, $datacenter, $botAPI) {
|
function () use ($request_id, $response, $datacenter, $botAPI) {
|
||||||
$r = isset($response['_']) ? $response['_'] : json_encode($response);
|
$r = isset($response['_']) ? $response['_'] : json_encode($response);
|
||||||
@ -653,7 +655,7 @@ trait ResponseHandler
|
|||||||
$d = $this->update_deferred;
|
$d = $this->update_deferred;
|
||||||
$this->update_deferred = null;
|
$this->update_deferred = null;
|
||||||
|
|
||||||
$d->resolve();
|
Loop::defer([$d, 'resolve']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ 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 Amp\Loop;
|
||||||
use function Amp\Promise\any;
|
use function Amp\Promise\any;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -292,7 +293,7 @@ trait UpdateHandler
|
|||||||
$d = $this->update_deferred;
|
$d = $this->update_deferred;
|
||||||
$this->update_deferred = null;
|
$this->update_deferred = null;
|
||||||
|
|
||||||
$d->resolve();
|
Loop::defer([$d, 'resolve']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user