-
Notifications
You must be signed in to change notification settings - Fork 77
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
SLVS-1431 Add server connection json model and mapper #5658
SLVS-1431 Add server connection json model and mapper #5658
Conversation
…aps the model from the logic model to the json model and vice-versa
Quality Gate failedFailed conditions |
@@ -25,7 +25,7 @@ public abstract class ServerConnection | |||
internal static readonly ServerConnectionSettings DefaultSettings = new(true); | |||
|
|||
public string Id { get; } | |||
public ServerConnectionSettings Settings { get; } | |||
public ServerConnectionSettings Settings { get; set; } |
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.
Why was the setter added?
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.
Because in the repository we have TryUpdateSettingsById, which requires to add the settings to an existing ServerConnection model
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.
I don't know if we should do that. Feels like a thread safety issue. The model can be modified from another thread. Could we make it immutable? Would that have big implications on other parts of the code?
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.
In the repository, I am reading the file and then retrieving the ServerConnection model for the provided Id. I then have to update the settings:
I either allow modification of the settings or I need to create a new instance of the ServerConnection (which is immutable), then remove it from the list, then re-add the new instance. This feels a lot more error-prone and unexpected.
I could make instead the IsSmartNotificationsEnabled editable (add a setter for it). Also I don't think we should be too paranoid about the multi-threading. Because all the write operations to the connections should only happen via the UI. And the UI will be blocked while anything in the connection is modified
61c9605
into
feature/new-connected-mode
SLVS-1431