mirror of
https://github.com/twisterarmy/twister-rss-bot.git
synced 2025-01-30 16:44:34 +00:00
prevent multi-thread execution
This commit is contained in:
parent
932b5c76a6
commit
fbe17d0bc3
@ -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…
x
Reference in New Issue
Block a user