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

Simplify SuicideActor to make it perform 0 writes #289

Merged

Conversation

Arkatufus
Copy link
Contributor

  • Remove Persist and SaveSnapshot from SuicideActor
  • Make sure that all tests are actually tested against a storage failure condition, not message recovery failure condition.

Copy link
Contributor Author

@Arkatufus Arkatufus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self-review

@Arkatufus
Copy link
Contributor Author

Arkatufus commented Jul 17, 2024

public SuicideProbe(IActorRef probe, string persistenceId, bool debugLog)
{
_probe = probe;
PersistenceId = persistenceId;
Recover<string>(_ =>
{
// no-op
});
Recover<SnapshotOffer>(_ =>
{
// no-op
});
Recover<RecoveryCompleted>(_ =>
{
_probe.Tell(PersistenceLivenessStatus.Healthy(null));
if(debugLog)
_log.Debug("Recovery complete");
Context.Stop(Self);
});
}
public override string PersistenceId { get; }
protected override void OnRecoveryFailure(Exception reason, object? message = null)
{
var msg = $"Recovery failure{(message is null ? "" : $": {message}")}";
_log.Error(reason, msg);
_probe.Tell(PersistenceLivenessStatus.Unhealthy(reason, msg));
Context.Stop(Self);

This is all of what SuicideActor does now, it is really simple and contains no logic whatsoever

@Aaronontheweb Aaronontheweb merged commit 1d0a923 into petabridge:dev Jul 17, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants