mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-16 17:23:04 +08:00
Fix performance issue in logger.
This commit is contained in:
@@ -6,16 +6,16 @@ using Newtonsoft.Json;
|
||||
|
||||
namespace MQTTnet.TestApp.UniversalWindows
|
||||
{
|
||||
public class JsonServerStorage : IMqttServerStorage
|
||||
public sealed class JsonServerStorage : IMqttServerStorage
|
||||
{
|
||||
private readonly string _filename = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "Retained.json");
|
||||
readonly string _filename = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "Retained.json");
|
||||
|
||||
public async Task SaveRetainedMessagesAsync(IList<MqttApplicationMessage> messages)
|
||||
public Task SaveRetainedMessagesAsync(IList<MqttApplicationMessage> messages)
|
||||
{
|
||||
await Task.CompletedTask;
|
||||
|
||||
var json = JsonConvert.SerializeObject(messages);
|
||||
File.WriteAllText(_filename, json);
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public async Task<IList<MqttApplicationMessage>> LoadRetainedMessagesAsync()
|
||||
|
||||
Reference in New Issue
Block a user