1
0
mirror of https://github.com/danog/MadelineProto.git synced 2025-01-23 07:51:14 +01:00

Make more syscalls async

This commit is contained in:
Daniil Gentili 2023-07-22 18:06:44 +02:00
parent 6b33318f27
commit a0bd11b142
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
2 changed files with 5 additions and 2 deletions

View File

@ -71,6 +71,7 @@ use Throwable;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
use function Amp\async; use function Amp\async;
use function Amp\File\deleteFile;
use function Amp\File\getSize; use function Amp\File\getSize;
use function Amp\Future\await; use function Amp\Future\await;
@ -1777,7 +1778,7 @@ final class MTProto implements TLCallback, LoggerGetter
], ],
], ],
); );
\unlink($path); deleteFile($path);
} }
} }
$sent = false; $sent = false;

View File

@ -851,7 +851,9 @@ trait Files
$this->downloadToStream($messageMedia, $stream, $cb, $size, -1); $this->downloadToStream($messageMedia, $stream, $cb, $size, -1);
} finally { } finally {
$unlock(); $unlock();
try {
deleteFile("$file.lock"); deleteFile("$file.lock");
} catch (Throwable) {}
$stream->close(); $stream->close();
} }
return $file; return $file;