Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onOneServer not working properly #79

Open
mahran419 opened this issue Jul 18, 2024 · 0 comments
Open

onOneServer not working properly #79

mahran419 opened this issue Jul 18, 2024 · 0 comments

Comments

@mahran419
Copy link

Hello All

I tried using onOneServer to prevent multiple executions since our system uses auto-scaling. However, the cron job sometimes runs once, and other times it runs multiple times within a 1-microsecond difference. Here are the solutions I've tried, but nothing has worked:

1- I am trying to change the drivers from Redis & MySQL
2- decrease timeout from 30 to 10
3- using usleep for 5 milliseconds

console config:

'mutex' => [
            'class' => 'yii\redis\Mutex'
        ],

cronjobs implementation:

$schedule->call(function(\yii\console\Application $app) {
    \Yii::$app->sms->send("966**********", "One Server ".time());
})->everyMinute()->description("cron_every_minute")->onOneServer();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant