Browse Source

prevent multi-thread execution

main
ghost 11 months ago
parent
commit
fbe17d0bc3
  1. 15
      src/cli/bot.php

15
src/cli/bot.php

@ -10,6 +10,21 @@ $config = json_decode( @@ -10,6 +10,21 @@ $config = json_decode(
)
);
// Prevent multi-thread execution
$semaphore = sem_get(
crc32(
__DIR__ . '.twister.rss.bot'
),
1
);
if (false === sem_acquire($semaphore, true))
{
exit(
_('Process locked by another thread') . PHP_EOL
);
}
// Connect twister
try
{

Loading…
Cancel
Save