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 for error on complex case involving multiple distribution destroy… #4669

Merged
merged 1 commit into from
Sep 28, 2024

Conversation

dorner
Copy link
Collaborator

@dorner dorner commented Sep 27, 2024

Unfortunately I wasn't able to come up with a natural test case for this. I was able to confirm it works with a copy of prod data though.

Long story short - a number of events interacted with each other weirdly because we are using eventable in the aggregate code. This actually does a database call, and if the object in question isn't there (because, say, it was destroyed), this returns nil. The code then uses this nil value as a hash lookup, meaning that all similar events would be grouped together and cause weirdness with math since items it expects to be there aren't, and vice versa.

Due to emergent properties of the system, it happens to be that in most cases this still works as expected, which is kind of bizarre. Hence my inability to get a working unit test.

As a side benefit, all the DB calls now disappear and this code is much much faster than it was.

@cielf cielf requested a review from awwaiid September 28, 2024 16:23
Copy link
Collaborator

@awwaiid awwaiid left a comment

Choose a reason for hiding this comment

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

Well. It certainly is more correct this way.

@awwaiid awwaiid merged commit 640b7ba into main Sep 28, 2024
22 checks passed
@awwaiid awwaiid deleted the fix-distribution-error branch September 28, 2024 16:50
Copy link
Contributor

@dorner: Your PR Fix for error on complex case involving multiple distribution destroy… is part of today's Human Essentials production release: 2024.09.29.
Thank you very much for your contribution!

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