peppeocchi / php-cron-scheduler

PHP cron job scheduler
MIT License
811 stars 144 forks source link

each execution call 3 times of my function #103

Closed hafung closed 4 years ago

hafung commented 4 years ago

I do the cron in wsl 2(docker)

crontab l:

in function, it just the code copy from example, none special at all

anywork, it works, but each execution call 3 times of my function, it bothers me

And the onlyOne does not affact

hafung commented 4 years ago

log below:

[2020-06-21T14:24:03.777479+07:00] Cron.INFO: John Doe [] [] [2020-06-21T14:24:03.986969+07:00] Cron.INFO: John Doe [] [] [2020-06-21T14:24:04.575456+07:00] Cron.INFO: John Doe [] []

hafung commented 4 years ago

code:

    $logger = $this->getLogger();

    $this->schedule->call(
        function ($firstName, $lastName) use ($logger) {

            $logger->info(implode(' ', [$firstName, $lastName]));
        },
        [
            'John',
            'last_name' => 'Doe', // The keys are being ignored
        ],
        'myCustomIdentifier1'
    )->everyMinute(1)->onlyOne();
hafung commented 4 years ago

ooops, my fault, i started cron 3 times..