diff -r dd9e98b25213 -r 85f0fe1bb78b cubicweb/server/repository.py --- a/cubicweb/server/repository.py Mon Mar 30 15:46:12 2020 +0200 +++ b/cubicweb/server/repository.py Tue Mar 31 16:17:14 2020 +0200 @@ -251,10 +251,14 @@ self.exception('error while closing %s, error: %s' % (cnxset, e)) -def get_cnxset(source, size): - if not size: +def get_cnxset(config, source, bootstrap=False): + if not config['connections-pooler-enabled']: return _BaseCnxSet(source) - return _CnxSetPool(source, min_size=1, max_size=size) + if bootstrap or config.quick_start: + max_size = 1 + else: + max_size = config['connections-pool-size'] + return _CnxSetPool(source, min_size=1, max_size=max_size) class Repository(object): @@ -293,16 +297,9 @@ self.info('starting repository from %s', self.config.apphome) self.shutting_down = False config = self.config - # copy pool size here since config.init_cube() and config.load_schema() - # reload configuration from file and could reset a manually set pool - # size. - if config['connections-pooler-enabled']: - pool_size, min_pool_size = config['connections-pool-size'], 1 - else: - pool_size = min_pool_size = None # 0. init a cnxset that will be used to fetch bootstrap information from # the database - self.cnxsets = get_cnxset(self.system_source, min_pool_size) + self.cnxsets = get_cnxset(config, self.system_source, bootstrap=True) # 1. set used cubes if config.creating or not config.read_instance_schema: config.bootstrap_cubes() @@ -318,8 +315,6 @@ # the registry config.cube_appobject_path = set(('hooks', 'entities')) config.cubicweb_appobject_path = set(('hooks', 'entities')) - # limit connections pool size - pool_size = min_pool_size if config.quick_start or config.creating or not config.read_instance_schema: # load schema from the file system if not config.creating: @@ -351,7 +346,7 @@ # 4. close initialization connection set and reopen fresh ones for # proper initialization self.cnxsets.close() - self.cnxsets = get_cnxset(self.system_source, pool_size) + self.cnxsets = get_cnxset(config, self.system_source) # 5. call instance level initialisation hooks self.hm.call_hooks('server_startup', repo=self)