Skip to content
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

Use ConcurrentDictionary for JsonRPC Settings #2428

Merged
merged 1 commit into from
Nov 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
Expand All @@ -16,10 +17,10 @@ public class JsonRPCPluginSettings
public Dictionary<string, FrameworkElement> SettingControls { get; } = new();

public IReadOnlyDictionary<string, object> Inner => Settings;
protected Dictionary<string, object> Settings { get; set; }
protected ConcurrentDictionary<string, object> Settings { get; set; }
public required IPublicAPI API { get; init; }

private JsonStorage<Dictionary<string, object>> _storage;
private JsonStorage<ConcurrentDictionary<string, object>> _storage;

// maybe move to resource?
private static readonly Thickness settingControlMargin = new(0, 9, 18, 9);
Expand All @@ -33,7 +34,7 @@ public class JsonRPCPluginSettings

public async Task InitializeAsync()
{
_storage = new JsonStorage<Dictionary<string, object>>(SettingPath);
_storage = new JsonStorage<ConcurrentDictionary<string, object>>(SettingPath);
Settings = await _storage.LoadAsync();

foreach (var (type, attributes) in Configuration.Body)
Expand Down
Loading