capistrano / symfony

Capistrano tasks for deploying the Symfony standard edition
MIT License
354 stars 65 forks source link

Cache warmup SSH commands being executed multiple times per host #122

Open adfinlay opened 4 years ago

adfinlay commented 4 years ago

After updating to Symfony 4.4 and migrating to v2 of this gem I was reviewing deploy logs and noticed that the symfony:cache:warmup task was running the SSH command itself multiple times per server. I deploy to 9 servers, and the command looks like it's running 81 times, 9 per server.

The symfony_console call in that task is wrapped in an on:

https://github.com/capistrano/symfony/blob/master/lib/capistrano/tasks/symfony.rake#L31

Then the symfony_console function itself contains another on:

https://github.com/capistrano/symfony/blob/master/lib/capistrano/dsl/symfony.rb#L42

So it looks like it's saying "on each server, run the cache warmup command on each server". Am I misunderstanding this and I have a different issue? This explanation seems to fit the results I'm seeing.

kissifrot commented 4 years ago

Hello, this is indeed a bug, so either commit 5f0bf73226cfe4cc000115acf89127b65ecef6dc should be reverted or the additional on should be removed.

adfinlay commented 4 years ago

@kissifrot I think it would make more sense to revert the commit as opposed to removing the on from all of the places that symfony_console is called, as those make sense. IMO symfony_console is responsible for running the console and shouldn't concern itself with roles.

However, it would seem that "execute should be wrapped in an 'on' scope" so we may be stuck with removing the on scope from the call sites as your PR does.