private function drain()
{
for ($i = key($this->queue); isset($this->queue[$i]); $i++) {
$cancellable = $this->queue[$i];
$ex = null;
try {
$cancellable->cancel();
} catch (Error $ex) {
} catch (Exception $ex) {
}
unset($this->queue[$i]);
if ($ex) {
throw $ex;
}
}
$this->queue = [];
}