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: FetchForWritng() async projection returns null if there are no additional events to apply #3084

Merged

Conversation

elexisvenator
Copy link
Contributor

When applying events to update an async projection snapshot, existing behavior returns null instead of the snapshot if there are no events to apply.
From codegen:

        public override GroupProjection Build(IReadOnlyList<IEvent> events, IQuerySession session, GroupProjection snapshot)
        {
            if (!events.Any()) return null;  // This is the problem, there are no additional events to apply, should return snapshot
            GroupProjection groupProjection = null; // this also appears to be a no-op
            
            // ...

            return snapshot;
        }

Testing this has been a headache - I am clearly missing something when it comes to properly testing generated code. In theory the included test matches my applications code but does not reproduce the issue. Additionally the following other bugs are identified:

  • Calling RebuildProjection on a projection whose type is a nested class does not work due to the way the type name is compared to the registered projections.
  • The projection randomly is not populated, with the 'Name' property being null. But this only happens 25% of the time - feels like async projection stuff happening in the background but I thought RebuildProjection would block until the rebuild is done.

@jeremydmiller jeremydmiller merged commit 8eb23d0 into JasperFx:master Mar 25, 2024
7 of 11 checks passed
@elexisvenator elexisvenator deleted the async-fetchforwriting-bug branch March 25, 2024 22:28
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