-
Notifications
You must be signed in to change notification settings - Fork 115
core: nmea-injector: Make settings persistent between sessions #986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core: nmea-injector: Make settings persistent between sessions #986
Conversation
8dbb729 to
168cbba
Compare
3b3af1d to
1fea99b
Compare
|
|
||
| def __init__(self) -> None: | ||
| self._socks: Dict[NMEASocket, Union[asyncio.AbstractServer, asyncio.BaseTransport]] = {} | ||
| self._settings_manager = Manager("NmeaInjector", SettingsV1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are using lowercase for our settings name.
| else: | ||
| raise UnsupportedSocketKind(f"Got {sock.kind}. Expected one of: {[kind.value for kind in SocketKind]}.") | ||
| self._socks[sock] = server_socket | ||
| settings_spec = NmeaInjectorSettingsSpecV1.from_spec(sock) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to have such method encapsulate over a free function or inside the NMEASocket class, the reason behind this is that each settings version will need to implement such function unnecessary, like V1, V2, v3, so every time that we update the settings such method will need to exist.
If we move it to a free function or inside the NMEASocket class, the function will only need to exist in a single place and be updated when the settings version change, over duplicating such method over and over for each settings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. Was following the same pattern as the Bridget implementation, but this seems better.
| component_id = pykson.IntegerField() | ||
|
|
||
| @staticmethod | ||
| def from_spec(spec: "NmeaInjectorSpec") -> "NmeaInjectorSettingsSpecV1": # type: ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8812683 to
a125f81
Compare
|
@patrickelectric I'm waiting for the image build to test with the modifications. |
This will make people lose it currently settings, but since we already had the "non-persistent" banner on the frontend till now, that's what they were expecting.
a125f81 to
e259069
Compare
I tested and eveything appears to be working. |

Fix #708
Image available.