mirror of
https://github.com/YGGverse/YGGo.git
synced 2025-01-24 21:44:59 +00:00
prevent scheduled execution on cli/yggo running
This commit is contained in:
parent
3e3b7ee2ef
commit
547cd6717b
@ -5,7 +5,16 @@ $semaphore = sem_get(crc32('crontab.cleaner'), 1);
|
|||||||
|
|
||||||
if (false === sem_acquire($semaphore, true)) {
|
if (false === sem_acquire($semaphore, true)) {
|
||||||
|
|
||||||
echo 'Process locked by another thread.' . PHP_EOL;
|
echo 'process locked by another thread.' . PHP_EOL;
|
||||||
|
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;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,16 @@ $semaphore = sem_get(crc32('crontab.crawler'), 1);
|
|||||||
|
|
||||||
if (false === sem_acquire($semaphore, true)) {
|
if (false === sem_acquire($semaphore, true)) {
|
||||||
|
|
||||||
echo 'Process locked by another thread.' . PHP_EOL;
|
echo 'process locked by another thread.' . PHP_EOL;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stop crawler 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;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -719,9 +728,10 @@ foreach ($db->getHostPageCrawlQueue(CRAWL_PAGE_LIMIT, time() - CRAWL_PAGE_SECOND
|
|||||||
if (copy($hostPageSnapFilenameTmp, $storage->directory . $hostPageSnapPath . $hostPageSnapTimeAdded . '.zip')) {
|
if (copy($hostPageSnapFilenameTmp, $storage->directory . $hostPageSnapPath . $hostPageSnapTimeAdded . '.zip')) {
|
||||||
|
|
||||||
// Register storage name
|
// Register storage name
|
||||||
$db->addHostPageSnapStorage($hostPageSnapId, $crc32name, time());
|
if ($db->addHostPageSnapStorage($hostPageSnapId, $crc32name, time())) {
|
||||||
|
|
||||||
$snapFilesExists = true;
|
$snapFilesExists = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -752,9 +762,10 @@ foreach ($db->getHostPageCrawlQueue(CRAWL_PAGE_LIMIT, time() - CRAWL_PAGE_SECOND
|
|||||||
if ($ftp->copy($hostPageSnapFilenameTmp, 'hp/' . $hostPageSnapPath . $hostPageSnapTimeAdded . '.zip')) {
|
if ($ftp->copy($hostPageSnapFilenameTmp, 'hp/' . $hostPageSnapPath . $hostPageSnapTimeAdded . '.zip')) {
|
||||||
|
|
||||||
// Register storage name
|
// Register storage name
|
||||||
$db->addHostPageSnapStorage($hostPageSnapId, $crc32name, time());
|
if ($db->addHostPageSnapStorage($hostPageSnapId, $crc32name, time())) {
|
||||||
|
|
||||||
$snapFilesExists = true;
|
$snapFilesExists = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$ftp->close();
|
$ftp->close();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user