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.set_user(request.session.user)
|
||||||
|
|
||||||
# session options
|
# session options
|
||||||
session.options.config_reset()
|
|
||||||
for option in request.session.options.values():
|
for option in request.session.options.values():
|
||||||
session.options.set_config(option.name, option.value)
|
session.options.set_config(option.name, option.value)
|
||||||
session.metadata = dict(request.session.metadata)
|
session.metadata = dict(request.session.metadata)
|
||||||
|
|
|
@ -147,12 +147,7 @@ class Session:
|
||||||
self.config_handlers: List[Callable[[ConfigData], None]] = []
|
self.config_handlers: List[Callable[[ConfigData], None]] = []
|
||||||
|
|
||||||
# session options/metadata
|
# session options/metadata
|
||||||
self.options: SessionConfig = SessionConfig()
|
self.options: SessionConfig = SessionConfig(config)
|
||||||
if not config:
|
|
||||||
config = {}
|
|
||||||
for key in config:
|
|
||||||
value = config[key]
|
|
||||||
self.options.set_config(key, value)
|
|
||||||
self.metadata: Dict[str, str] = {}
|
self.metadata: Dict[str, str] = {}
|
||||||
|
|
||||||
# distributed support and logic
|
# distributed support and logic
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import Any, List
|
from typing import Any, Dict, List
|
||||||
|
|
||||||
from core.config import (
|
from core.config import (
|
||||||
ConfigBool,
|
ConfigBool,
|
||||||
|
@ -44,9 +44,12 @@ class SessionConfig(ConfigurableManager, ConfigurableOptions):
|
||||||
]
|
]
|
||||||
config_type: RegisterTlvs = RegisterTlvs.UTILITY
|
config_type: RegisterTlvs = RegisterTlvs.UTILITY
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self, config: Dict[str, str] = None) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.set_configs(self.default_values())
|
self.set_configs(self.default_values())
|
||||||
|
if config:
|
||||||
|
for key, value in config.items():
|
||||||
|
self.set_config(key, value)
|
||||||
|
|
||||||
def get_config(
|
def get_config(
|
||||||
self,
|
self,
|
||||||
|
|
Loading…
Reference in a new issue