Skip to content

Commit

Permalink
Ensure all state recovery changes are serialized
Browse files Browse the repository at this point in the history
  • Loading branch information
glopesdev committed May 15, 2024
1 parent bb17c51 commit 818239a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Aeon.Acquisition/StateRecoverySubject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System;
using System.ComponentModel;
using System.Linq.Expressions;
using System.Reactive.Linq;
using System.Reactive.Subjects;

namespace Aeon.Acquisition
Expand Down Expand Up @@ -39,11 +40,9 @@ public RecoverySubject(string name)
{
var state = StateRecovery<T>.Deserialize(name);
subject = new BehaviorSubject<T>(state);
Name = name;
subject.Skip(1).Subscribe(value => StateRecovery<T>.Serialize(name, value));
}

string Name { get; }

public void OnCompleted()
{
}
Expand All @@ -64,7 +63,6 @@ public IDisposable Subscribe(IObserver<T> observer)

public void Dispose()
{
StateRecovery<T>.Serialize(Name, subject.Value);
subject.Dispose();
}
}
Expand Down

0 comments on commit 818239a

Please sign in to comment.