1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-26 19:04:40 +01:00

Misc fixes

This commit is contained in:
Daniil Gentili 2024-05-29 21:10:29 +02:00
parent 649b38ca15
commit ae2e4a1692
3 changed files with 10 additions and 7 deletions

View File

@ -276,11 +276,11 @@ final class Logger
$this->colors[self::WARNING] = implode(';', [self::FOREGROUND['white'], self::SET['dim'], self::BACKGROUND['red']]);
$this->colors[self::ERROR] = implode(';', [self::FOREGROUND['white'], self::SET['bold'], self::BACKGROUND['red']]);
$this->colors[self::FATAL_ERROR] = implode(';', [self::FOREGROUND['red'], self::SET['bold'], self::BACKGROUND['light_gray']]);
$this->newline = PHP_EOL;
$newline = PHP_EOL;
if ($this->mode === self::ECHO_LOGGER) {
$stdout = getStdout();
if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') {
$this->newline = '<br>'.$this->newline;
$newline = '<br>'.$newline;
}
} elseif ($this->mode === self::FILE_LOGGER) {
$stdout = new WritableResourceStream(fopen($this->optional, 'a'));
@ -309,6 +309,7 @@ final class Logger
$stdout = getStderr();
}
}
$this->newline = $newline;
if (isset($stdout)) {
$pipe = new Pipe(PHP_INT_MAX);

View File

@ -189,10 +189,12 @@ class MTProtoOutgoingMessage extends MTProtoMessage
$this->connection->inFlightGauge?->dec([
'method' => $this->constructor,
]);
$this->connection->requestLatencies?->observe(
hrtime(true) - $this->sent,
['method' => $this->constructor]
);
if (!\is_callable($result)) {
$this->connection->requestLatencies?->observe(
hrtime(true) - $this->sent,
['method' => $this->constructor]
);
}
}
$this->serializedBody = null;

View File

@ -195,7 +195,7 @@ trait Session
$this->requestLatencies = $this->API->getPromHistogram(
"MadelineProto",
"request_latencies",
"Request latency in nanoseconds by method",
"Successful request latency in nanoseconds by method",
$labels,
[
5_000_000,