diff --git a/src/Akka.HealthCheck.Persistence/AkkaPersistenceLivenessProbe.cs b/src/Akka.HealthCheck.Persistence/AkkaPersistenceLivenessProbe.cs index cc1f794..07a2b89 100644 --- a/src/Akka.HealthCheck.Persistence/AkkaPersistenceLivenessProbe.cs +++ b/src/Akka.HealthCheck.Persistence/AkkaPersistenceLivenessProbe.cs @@ -23,10 +23,12 @@ public class AkkaPersistenceLivenessProbe : ActorBase, IWithUnboundedStash private int _probeCounter; private bool _snapshotStoreLive; private readonly TimeSpan _delay; + private readonly string _id; public AkkaPersistenceLivenessProbe(TimeSpan delay) { _delay = delay; + _id = Guid.NewGuid().ToString("N"); } public AkkaPersistenceLivenessProbe() : this(TimeSpan.FromSeconds(10)) { @@ -121,7 +123,7 @@ protected override void PreStart() private void CreateProbe(bool firstTime) { - _probe = Context.ActorOf(Props.Create(() => new SuicideProbe(Self, firstTime))); + _probe = Context.ActorOf(Props.Create(() => new SuicideProbe(Self, firstTime, _id))); if(firstTime) { _probe.Tell("hit" + _probeCounter++); @@ -168,11 +170,11 @@ public class SuicideProbe : ReceivePersistentActor private bool _recoveredJournal; private bool _recoveredSnapshotStore; - public SuicideProbe(IActorRef probe, bool firstAttempt) + public SuicideProbe(IActorRef probe, bool firstAttempt, string id) { _probe = probe; _firstAttempt = firstAttempt; - PersistenceId = "Akka.HealthCheck"; + PersistenceId = $"Akka.HealthCheck-{id}"; Recover(str => { @@ -202,7 +204,7 @@ public SuicideProbe(IActorRef probe, bool firstAttempt) if (!_firstAttempt) { DeleteMessages(save.Metadata.SequenceNr - 1); - DeleteSnapshots(new SnapshotSelectionCriteria(save.Metadata.SequenceNr - 1)); + DeleteSnapshots(new SnapshotSelectionCriteria(save.Metadata.SequenceNr - 1)); } Context.Stop(Self);