daemon: fixed issue starting session and clearing session options, small cleanup to SessionOptions init
This commit is contained in:
parent
08637d35b3
commit
9d97699b1f
3 changed files with 6 additions and 9 deletions
|
@ -262,7 +262,6 @@ class CoreGrpcServer(core_pb2_grpc.CoreApiServicer):
|
|||
session.set_user(request.session.user)
|
||||
|
||||
# session options
|
||||
session.options.config_reset()
|
||||
for option in request.session.options.values():
|
||||
session.options.set_config(option.name, option.value)
|
||||
session.metadata = dict(request.session.metadata)
|
||||
|
|
|
@ -147,12 +147,7 @@ class Session:
|
|||
self.config_handlers: List[Callable[[ConfigData], None]] = []
|
||||
|
||||
# session options/metadata
|
||||
self.options: SessionConfig = SessionConfig()
|
||||
if not config:
|
||||
config = {}
|
||||
for key in config:
|
||||
value = config[key]
|
||||
self.options.set_config(key, value)
|
||||
self.options: SessionConfig = SessionConfig(config)
|
||||
self.metadata: Dict[str, str] = {}
|
||||
|
||||
# distributed support and logic
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from typing import Any, List
|
||||
from typing import Any, Dict, List
|
||||
|
||||
from core.config import (
|
||||
ConfigBool,
|
||||
|
@ -44,9 +44,12 @@ class SessionConfig(ConfigurableManager, ConfigurableOptions):
|
|||
]
|
||||
config_type: RegisterTlvs = RegisterTlvs.UTILITY
|
||||
|
||||
def __init__(self) -> None:
|
||||
def __init__(self, config: Dict[str, str] = None) -> None:
|
||||
super().__init__()
|
||||
self.set_configs(self.default_values())
|
||||
if config:
|
||||
for key, value in config.items():
|
||||
self.set_config(key, value)
|
||||
|
||||
def get_config(
|
||||
self,
|
||||
|
|
Loading…
Reference in a new issue