mirror of
https://github.com/YGGverse/YGGo.git
synced 2025-02-03 10:25:52 +00:00
fix semaphores
This commit is contained in:
parent
48e0482dbd
commit
43776b5ff4
20
cli/yggo.php
20
cli/yggo.php
@ -16,16 +16,6 @@ if (php_sapi_name() != 'cli') {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lock multi-thread execution
|
|
||||||
$semaphore = sem_get(crc32('crontab.crawler'), 1);
|
|
||||||
|
|
||||||
if (false === sem_acquire($semaphore, true)) {
|
|
||||||
|
|
||||||
CLI::danger(_('process locked by another thread.'));
|
|
||||||
CLI::break();
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stop CLI execution on cleaner process running
|
// Stop CLI execution on cleaner process running
|
||||||
$semaphore = sem_get(crc32('crontab.cleaner'), 1);
|
$semaphore = sem_get(crc32('crontab.cleaner'), 1);
|
||||||
|
|
||||||
@ -46,6 +36,16 @@ if (false === sem_acquire($semaphore, true)) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Lock multi-thread execution
|
||||||
|
$semaphore = sem_get(crc32('cli.yggo'), 1);
|
||||||
|
|
||||||
|
if (false === sem_acquire($semaphore, true)) {
|
||||||
|
|
||||||
|
CLI::danger(_('process locked by another thread.'));
|
||||||
|
CLI::break();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Connect database
|
// Connect database
|
||||||
$db = new MySQL(DB_HOST, DB_PORT, DB_NAME, DB_USERNAME, DB_PASSWORD);
|
$db = new MySQL(DB_HOST, DB_PORT, DB_NAME, DB_USERNAME, DB_PASSWORD);
|
||||||
|
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
// Stop cleaner on cli running
|
||||||
|
$semaphore = sem_get(crc32('cli.yggo'), 1);
|
||||||
|
|
||||||
|
if (false === sem_acquire($semaphore, true)) {
|
||||||
|
|
||||||
|
echo 'cli.yggo process running in another thread.' . PHP_EOL;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Lock multi-thread execution
|
// Lock multi-thread execution
|
||||||
$semaphore = sem_get(crc32('crontab.cleaner'), 1);
|
$semaphore = sem_get(crc32('crontab.cleaner'), 1);
|
||||||
|
|
||||||
@ -9,14 +18,6 @@ if (false === sem_acquire($semaphore, true)) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop cleaner on cli running
|
|
||||||
$semaphore = sem_get(crc32('cli.yggo'), 1);
|
|
||||||
|
|
||||||
if (false === sem_acquire($semaphore, true)) {
|
|
||||||
|
|
||||||
echo 'cli.yggo process running in another thread.' . PHP_EOL;
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load system dependencies
|
// Load system dependencies
|
||||||
require_once(__DIR__ . '/../config/app.php');
|
require_once(__DIR__ . '/../config/app.php');
|
||||||
|
@ -1,14 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Lock multi-thread execution
|
|
||||||
$semaphore = sem_get(crc32('crontab.crawler'), 1);
|
|
||||||
|
|
||||||
if (false === sem_acquire($semaphore, true)) {
|
|
||||||
|
|
||||||
echo 'process locked by another thread.' . PHP_EOL;
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stop crawler on cli running
|
// Stop crawler on cli running
|
||||||
$semaphore = sem_get(crc32('cli.yggo'), 1);
|
$semaphore = sem_get(crc32('cli.yggo'), 1);
|
||||||
|
|
||||||
@ -18,6 +9,15 @@ if (false === sem_acquire($semaphore, true)) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Lock multi-thread execution
|
||||||
|
$semaphore = sem_get(crc32('crontab.crawler'), 1);
|
||||||
|
|
||||||
|
if (false === sem_acquire($semaphore, true)) {
|
||||||
|
|
||||||
|
echo 'process locked by another thread.' . PHP_EOL;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Load system dependencies
|
// Load system dependencies
|
||||||
require_once(__DIR__ . '/../config/app.php');
|
require_once(__DIR__ . '/../config/app.php');
|
||||||
require_once(__DIR__ . '/../library/ftp.php');
|
require_once(__DIR__ . '/../library/ftp.php');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user