Artisan commands runs twice?
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
-
- Posts: 44
- Joined: 05 Feb 2018, 09:57
Artisan commands runs twice?
Hi. I am not sure if this is normal, but I find it strange. When I am working with artisan commands, for example importing products from CSV or running services, and I dump anything, I get it twice in command line (see attached screenshot). This happens in each command, in every Aimeos version.
After command is finished, it doesnt seem to run twice. For example products are not imported twice, or services run 2 times in a row. Is that a bug or feature?
After command is finished, it doesnt seem to run twice. For example products are not imported twice, or services run 2 times in a row. Is that a bug or feature?

- Attachments
-
- Snip20180729_24.png (91.96 KiB) Viewed 11312 times
-
- Snip20180729_23.png (113.16 KiB) Viewed 11312 times
Re: Artisan commands runs twice?
The process() method is called as often as items need to be processed, only the run() method is called once when executing the artisan command
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

-
- Posts: 44
- Joined: 05 Feb 2018, 09:57
Re: Artisan commands runs twice?
It's the same when I dump it in run method:
- Attachments
-
- Snip20180730_29.png (25.9 KiB) Viewed 11308 times
-
- Snip20180730_28.png (20.35 KiB) Viewed 11308 times
Re: Artisan commands runs twice?
We tested with
in the \Aimeos\Controller\Jobs\Order\Service\Delivery\Standard::run() method and it's only printed once. Do you have several sites the job controller is looping over?
Code: Select all
echo __METHOD__;
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

-
- Posts: 44
- Joined: 05 Feb 2018, 09:57
Re: Artisan commands runs twice?
It's printed twice:
Aimeos\Controller\Jobs\Order\Service\Delivery\Standard::run
and this happens in every job, services, product imports etc. I only have 1 default site. Any idea why is this happening?
Aimeos\Controller\Jobs\Order\Service\Delivery\Standard::run
and this happens in every job, services, product imports etc. I only have 1 default site. Any idea why is this happening?
Re: Artisan commands runs twice?
I would guess there's more than one site nevertheless. Can you have a look into the mshop_locale_site table if there's really only one record?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

-
- Posts: 44
- Joined: 05 Feb 2018, 09:57
Re: Artisan commands runs twice?
Yes, there is only one record.
Anyway, if it would be the case of 2 sites, it would also be printed that way, not?
You can see from my screenshot:
If there are 2, I would expect something like
Anyway, if it would be the case of 2 sites, it would also be printed that way, not?
You can see from my screenshot:
Code: Select all
"Executing the Aimeos Job for default"
dump in run
dump in run
Code: Select all
"Executing the Aimeos Job for default"
dump in run
"Executing the Aimeos Job for site2"
dump in run
Re: Artisan commands runs twice?
Yes, that's true. Each site output would be printed separately.
There are three reasons why the same job is executed twice:
- For different sites (https://github.com/aimeos/aimeos-larave ... nd.php#L56)
- If the job name is twice in the list of jobs to execute (https://github.com/aimeos/aimeos-larave ... nd.php#L66)
- The job fails and it's automatically restarted (https://github.com/aimeos/aimeos-larave ... nd.php#L72)
"$process->start()" creates a new process that runs independently and if that fails, it's automatically executed again. This is the case in your situation because the job fails with status "256".
There are three reasons why the same job is executed twice:
- For different sites (https://github.com/aimeos/aimeos-larave ... nd.php#L56)
- If the job name is twice in the list of jobs to execute (https://github.com/aimeos/aimeos-larave ... nd.php#L66)
- The job fails and it's automatically restarted (https://github.com/aimeos/aimeos-larave ... nd.php#L72)
"$process->start()" creates a new process that runs independently and if that fails, it's automatically executed again. This is the case in your situation because the job fails with status "256".
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

-
- Posts: 44
- Joined: 05 Feb 2018, 09:57
Re: Artisan commands runs twice?
Aha, indeed. dd() method makes it failed with error 256. if I just echo something and return true, then it runs just once. Thanks for clarification!