Skip to content

Conversation

alexvaluyskiy
Copy link
Contributor

No description provided.

.ContinueWith(t =>
{
if (!t.IsFaulted && !t.IsCanceled)
if (t.IsCompleted)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

!t.IsFaulted && !t.IsCanceled is the same as t.IsCompleted

@@ -253,43 +261,42 @@ private void HandleReplayMessages(ReplayMessages message)
// Send replayed messages and replay result to persistentActor directly. No need
// to resequence replayed messages relative to written and looped messages.
// not possible to use circuit breaker here
ReplayMessagesAsync(context, message.PersistenceId, message.FromSequenceNr, toSequenceNr,
message.Max, p =>
ReplayMessagesAsync(context, message.PersistenceId, message.FromSequenceNr, toSequenceNr, message.Max, p =>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we need the parameter context?

Copy link
Member

Choose a reason for hiding this comment

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

If the context is being handled asynchronously, then we do need to close over it... however, the context is volatile - so I'm not sure why we'd want to snapshot it. What data are we using from it?

Copy link
Contributor Author

@alexvaluyskiy alexvaluyskiy Jun 7, 2017

Choose a reason for hiding this comment

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

@cconstantin @Horusiath As I see - we dont use it in our persistence plugins

{
var msg = (LoadSnapshot) message;
var senderPersistentActor = Sender; // Sender is PersistentActor
var self = Self; //Self MUST BE CLOSED OVER here, or the code below will be subject to race conditions
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These variables should be closed over here, in order to prevent racing conditions

.ContinueWith(t =>
{
if (_publish) eventStream.Publish(message);
if (t.IsCompleted && _publish)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added an additional check

{
return (!t.IsFaulted && !t.IsCanceled)
? (object) new DeleteMessagesSuccess(message.ToSequenceNr)
_breaker.WithCircuitBreaker(() => DeleteMessagesToAsync(message.PersistenceId, message.ToSequenceNr))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Circuit Breaker was added here

Copy link
Member

Choose a reason for hiding this comment

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

Looks good to me, same as JVM source

Copy link
Member

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

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

Looks like good fixes to me. Nice work @alexvaluyskiy

{
return (!t.IsFaulted && !t.IsCanceled)
? (object) new DeleteMessagesSuccess(message.ToSequenceNr)
_breaker.WithCircuitBreaker(() => DeleteMessagesToAsync(message.PersistenceId, message.ToSequenceNr))
Copy link
Member

Choose a reason for hiding this comment

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

Looks good to me, same as JVM source

@@ -253,43 +261,42 @@ private void HandleReplayMessages(ReplayMessages message)
// Send replayed messages and replay result to persistentActor directly. No need
// to resequence replayed messages relative to written and looped messages.
// not possible to use circuit breaker here
ReplayMessagesAsync(context, message.PersistenceId, message.FromSequenceNr, toSequenceNr,
message.Max, p =>
ReplayMessagesAsync(context, message.PersistenceId, message.FromSequenceNr, toSequenceNr, message.Max, p =>
Copy link
Member

Choose a reason for hiding this comment

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

If the context is being handled asynchronously, then we do need to close over it... however, the context is volatile - so I'm not sure why we'd want to snapshot it. What data are we using from it?

.PipeTo(replyTo)
.ContinueWith(t =>
{
if (!t.IsFaulted && CanPublish) context.System.EventStream.Publish(message);
if (t.IsCompleted && CanPublish) eventStream.Publish(message);
Copy link
Member

Choose a reason for hiding this comment

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

Good idea to close over the EventStream 👍

@Aaronontheweb Aaronontheweb modified the milestone: 1.3.0 Jun 7, 2017
@Aaronontheweb Aaronontheweb merged commit 7aeac7e into akkadotnet:v1.3 Jun 7, 2017
@alexvaluyskiy alexvaluyskiy deleted the persistence_snapshotsfix branch June 8, 2017 05:40
Aaronontheweb pushed a commit to Aaronontheweb/akka.net that referenced this pull request Jun 28, 2017
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