core: remove writing of largeobject dirs on AppStartup.
- this makes celery much slower - creates a database connection on APP start which again makes celery explode sometimes - making a db connection on AppCreation could lead to some problems in future.
This commit is contained in:
parent
2d37a1e953
commit
022732590f
2 changed files with 4 additions and 32 deletions
|
|
@ -53,8 +53,8 @@ from rhodecode.lib.middleware.vcs import VCSMiddleware
|
|||
from rhodecode.lib.plugins.utils import register_rhodecode_plugin
|
||||
from rhodecode.lib.utils2 import aslist as rhodecode_aslist
|
||||
from rhodecode.subscribers import (
|
||||
scan_repositories_if_enabled, write_metadata_if_needed,
|
||||
write_js_routes_if_enabled, create_largeobjects_dirs_if_needed)
|
||||
scan_repositories_if_enabled, write_js_routes_if_enabled,
|
||||
write_metadata_if_needed)
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
|
@ -305,7 +305,6 @@ def includeme(config):
|
|||
settings['default_locale_name'] = settings.get('lang', 'en')
|
||||
|
||||
# Add subscribers.
|
||||
config.add_subscriber(create_largeobjects_dirs_if_needed, ApplicationCreated)
|
||||
config.add_subscriber(scan_repositories_if_enabled, ApplicationCreated)
|
||||
config.add_subscriber(write_metadata_if_needed, ApplicationCreated)
|
||||
config.add_subscriber(write_js_routes_if_enabled, ApplicationCreated)
|
||||
|
|
|
|||
|
|
@ -130,12 +130,12 @@ def scan_repositories_if_enabled(event):
|
|||
This is subscribed to the `pyramid.events.ApplicationCreated` event. It
|
||||
does a repository scan if enabled in the settings.
|
||||
"""
|
||||
from rhodecode.model.scm import ScmModel
|
||||
from rhodecode.lib.utils import repo2db_mapper, get_rhodecode_base_path
|
||||
settings = event.app.registry.settings
|
||||
vcs_server_enabled = settings['vcs.server.enable']
|
||||
import_on_startup = settings['startup.import_repos']
|
||||
if vcs_server_enabled and import_on_startup:
|
||||
from rhodecode.model.scm import ScmModel
|
||||
from rhodecode.lib.utils import repo2db_mapper, get_rhodecode_base_path
|
||||
repositories = ScmModel().repo_scan(get_rhodecode_base_path())
|
||||
repo2db_mapper(repositories, remove_obsolete=False)
|
||||
|
||||
|
|
@ -229,33 +229,6 @@ def write_js_routes_if_enabled(event):
|
|||
f.write(jsroutes_file_content)
|
||||
|
||||
|
||||
def create_largeobjects_dirs_if_needed(event):
|
||||
"""
|
||||
This is subscribed to the `pyramid.events.ApplicationCreated` event. It
|
||||
does a repository scan if enabled in the settings.
|
||||
"""
|
||||
from rhodecode.lib.utils import get_rhodecode_base_path
|
||||
from rhodecode.lib.vcs.backends.hg import largefiles_store
|
||||
from rhodecode.lib.vcs.backends.git import lfs_store
|
||||
|
||||
repo_store_path = get_rhodecode_base_path()
|
||||
|
||||
paths = [
|
||||
largefiles_store(repo_store_path),
|
||||
lfs_store(repo_store_path)]
|
||||
|
||||
for path in paths:
|
||||
if os.path.isdir(path):
|
||||
continue
|
||||
if os.path.isfile(path):
|
||||
continue
|
||||
# not a file nor dir, we try to create it
|
||||
try:
|
||||
os.makedirs(path)
|
||||
except Exception:
|
||||
log.warning('Failed to create largefiles dir:%s', path)
|
||||
|
||||
|
||||
class Subscriber(object):
|
||||
"""
|
||||
Base class for subscribers to the pyramid event system.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue