1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-27 02:34:39 +01:00

Explicitly unlock on process shutdown

This commit is contained in:
Daniil Gentili 2021-12-13 18:00:56 +01:00
parent d0fdbbf0b7
commit 57cb317bc3
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7

View File

@ -178,6 +178,9 @@ class Installer
self::$lock = \fopen($phar, 'c');
}
\flock(self::$lock, LOCK_SH);
\register_shutdown_function(static function () {
\flock(self::$lock, LOCK_UN);
});
$result = require_once $phar;
if (\defined('MADELINE_WORKER_TYPE') && \constant('MADELINE_WORKER_TYPE') === 'madeline-ipc') {
require_once "phar://$phar/vendor/danog/madelineproto/src/danog/MadelineProto/Ipc/Runner/entry.php";
@ -232,12 +235,12 @@ class Installer
if (!\file_exists($madeline_phar)) {
for ($x = 0; $x < 10; $x++) {
$pharTest = \file_get_contents(\sprintf(self::PHAR_TEMPLATE, $this->version, $remote_release.$x));
if ($pharTest && strpos($pharTest, $remote_release) !== false) {
if ($pharTest && \strpos($pharTest, $remote_release) !== false) {
$phar = $pharTest;
unset($pharTest);
break;
}
sleep(1);
\sleep(1);
}
if (!isset($phar)) {
return self::load($local_release);