Browse Source

update semaphore ID

sqlite
ghost 1 year ago
parent
commit
bfc73fd8bd
  1. 14
      crawler.php

14
crawler.php

@ -1,8 +1,12 @@ @@ -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)) { @@ -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…
Cancel
Save