Add chain spec parts to session paths

This commit is contained in:
lash 2022-05-15 11:32:42 +00:00
parent bb5e0b359f
commit 443e64f3e9
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
1 changed files with 17 additions and 3 deletions

View File

@ -48,8 +48,16 @@ def process_session(settings, config):
session_id = str(uuid.uuid4())
make_default = True
chain_spec = settings.get('CHAIN_SPEC')
network_id_str = str(chain_spec.network_id())
# create the session persistent dir
session_path = os.path.join(data_engine_dir, session_id)
session_path = os.path.join(
data_engine_dir,
chain_spec.arch(),
chain_spec.fork(),
network_id_str,
session_id,
)
if make_default:
fp = os.path.join(data_engine_dir, 'default')
os.symlink(session_path, fp)
@ -62,7 +70,14 @@ def process_session(settings, config):
runtime_path = config.get('SESSION_RUNTIME_PATH')
if runtime_path == None:
runtime_path = os.path.join('/run', 'user', str(uid), 'chaind', settings.get('CHAIND_BACKEND'))
runtime_path = os.path.join(runtime_path, config.get('CHAIND_ENGINE'), session_id)
runtime_path = os.path.join(
runtime_path,
config.get('CHAIND_ENGINE'),
chain_spec.arch(),
chain_spec.fork(),
str(chain_spec.network_id()),
session_id,
)
os.makedirs(runtime_path, exist_ok=True)
settings.set('SESSION_RUNTIME_PATH', runtime_path)
@ -73,7 +88,6 @@ def process_session(settings, config):
return settings
def process_socket(settings, config):
socket_path = config.get('SESSION_SOCKET_PATH')
if socket_path == None: