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

Fix SnapshotMetadata.Timestamp bug #7354

Merged

Conversation

Arkatufus
Copy link
Contributor

Fixes https://github.com/akkadotnet/akka.net/blame/554086ccba07338194aca2a1eb8e0f9d801973b7/src/core/Akka.Persistence/Eventsourced.cs#L221

  1. It uses DateTimeOffset.Date which strips the time portion of the DateTime struct
  2. DateTimeOffset.DateTime returns a DateTime object with DateTimeKind.Unspecified and we need DateTimeKind.Utc

Changes

Make sure that we use UTC DateTime everywhere

@Aaronontheweb Aaronontheweb added this to the 1.5.30 milestone Oct 3, 2024
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.

LGTM

@Aaronontheweb Aaronontheweb enabled auto-merge (squash) October 3, 2024 15:58
@Arkatufus
Copy link
Contributor Author

I'm pretty sure I've covered the majority use cases here, at least for things that were covered by our unit tests

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

@@ -218,7 +218,7 @@ public void LoadSnapshot(string persistenceId, SnapshotSelectionCriteria criteri
/// <param name="snapshot">TBD</param>
public void SaveSnapshot(object snapshot)
{
SnapshotStore.Tell(new SaveSnapshot(new SnapshotMetadata(SnapshotterId, SnapshotSequenceNr, Context.System.Scheduler.Now.Date), snapshot));
SnapshotStore.Tell(new SaveSnapshot(new SnapshotMetadata(SnapshotterId, SnapshotSequenceNr, Context.System.Scheduler.Now.UtcDateTime), snapshot));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the major fix for persistence

Copy link
Member

Choose a reason for hiding this comment

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

Yes that's much better than extending the scheduler interface

@Aaronontheweb Aaronontheweb merged commit d98d37f into akkadotnet:dev Oct 3, 2024
12 checks passed
@Arkatufus Arkatufus deleted the Fix-SnapshotMetadata-timestamp-bug branch October 3, 2024 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants