symfony icon indicating copy to clipboard operation
symfony copied to clipboard

Cache warmup SSH commands being executed multiple times per host

Open adfinlay opened this issue 4 years ago • 2 comments

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.

adfinlay avatar Aug 04 '20 13:08 adfinlay

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

kissifrot avatar Aug 06 '20 16:08 kissifrot

@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.

adfinlay avatar Aug 07 '20 10:08 adfinlay