mirror of https://github.com/docker/compose.git
Optimize "extends" without file specification
Loading the same config file add about 100ms per each extension service, which results in painfully slow CLI calls when a config consists of a couple of dozens of services. This patch makes Compose re-use config files. Signed-off-by: Vadim Semenov <protoss.player@gmail.com>
This commit is contained in:
parent
36772b555c
commit
e52f019ac8
|
@ -570,6 +570,15 @@ class ServiceExtendsResolver(object):
|
||||||
config_path = self.get_extended_config_path(extends)
|
config_path = self.get_extended_config_path(extends)
|
||||||
service_name = extends['service']
|
service_name = extends['service']
|
||||||
|
|
||||||
|
if config_path == self.service_config.filename:
|
||||||
|
try:
|
||||||
|
service_config = self.config_file.get_service(service_name)
|
||||||
|
except KeyError:
|
||||||
|
raise ConfigurationError(
|
||||||
|
"Cannot extend service '{}' in {}: Service not found".format(
|
||||||
|
service_name, config_path)
|
||||||
|
)
|
||||||
|
else:
|
||||||
extends_file = ConfigFile.from_filename(config_path)
|
extends_file = ConfigFile.from_filename(config_path)
|
||||||
validate_config_version([self.config_file, extends_file])
|
validate_config_version([self.config_file, extends_file])
|
||||||
extended_file = process_config_file(
|
extended_file = process_config_file(
|
||||||
|
|
Loading…
Reference in New Issue