From 43776b5ff4182d5523dcde6275c420508fb2e99a Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 1 Aug 2023 17:53:14 +0300 Subject: [PATCH] fix semaphores --- cli/yggo.php | 18 +++++++++--------- crontab/cleaner.php | 13 +++++++------ crontab/crawler.php | 12 ++++++------ 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/cli/yggo.php b/cli/yggo.php index 44d3286..457a983 100644 --- a/cli/yggo.php +++ b/cli/yggo.php @@ -16,32 +16,32 @@ if (php_sapi_name() != 'cli') { exit; } -// Lock multi-thread execution -$semaphore = sem_get(crc32('crontab.crawler'), 1); +// Stop CLI execution on cleaner process running +$semaphore = sem_get(crc32('crontab.cleaner'), 1); if (false === sem_acquire($semaphore, true)) { - CLI::danger(_('process locked by another thread.')); + CLI::danger(_('stop crontab.cleaner is running in another thread.')); CLI::break(); exit; } -// Stop CLI execution on cleaner process running -$semaphore = sem_get(crc32('crontab.cleaner'), 1); +// Stop CLI execution on crawler process running +$semaphore = sem_get(crc32('crontab.crawler'), 1); if (false === sem_acquire($semaphore, true)) { - CLI::danger(_('stop crontab.cleaner is running in another thread.')); + CLI::danger(_('stop crontab.crawler is running in another thread.')); CLI::break(); exit; } -// Stop CLI execution on crawler process running -$semaphore = sem_get(crc32('crontab.crawler'), 1); +// Lock multi-thread execution +$semaphore = sem_get(crc32('cli.yggo'), 1); if (false === sem_acquire($semaphore, true)) { - CLI::danger(_('stop crontab.crawler is running in another thread.')); + CLI::danger(_('process locked by another thread.')); CLI::break(); exit; } diff --git a/crontab/cleaner.php b/crontab/cleaner.php index ac35629..87a74f0 100644 --- a/crontab/cleaner.php +++ b/crontab/cleaner.php @@ -1,23 +1,24 @@