mirror of
https://github.com/kvazar-network/crawler-api-node.git
synced 2025-08-27 23:11:47 +00:00
update semaphore ID
This commit is contained in:
parent
e0831b59f5
commit
bfc73fd8bd
14
crawler.php
14
crawler.php
@ -1,8 +1,12 @@
|
||||
<?php
|
||||
|
||||
$semaphore = sem_get(1);
|
||||
$semaphore = sem_get(crc32('kvazar-network.crawler_api_node'), 1);
|
||||
|
||||
if (false !== sem_acquire($semaphore, 1)) {
|
||||
if (false === sem_acquire($semaphore, true)) {
|
||||
|
||||
echo "database locked by the another process..." . PHP_EOL;
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once(__DIR__ . '/config.php');
|
||||
require_once(__DIR__ . '/library/sqlite.php');
|
||||
@ -181,9 +185,3 @@ if (false !== sem_acquire($semaphore, 1)) {
|
||||
echo "scanning completed.\n";
|
||||
# print_r($response);
|
||||
}
|
||||
|
||||
sem_release($semaphore);
|
||||
|
||||
} else {
|
||||
echo "database locked by the another process...\n";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user